Standard points
SET poi 1 POINT 34.849 -111.9287
SET poi 2 POINT 32.893 -111.6650
SET poi 3 POINT 36.123 -110.3027
SET poi 4 POINT 35.746 -108.0175
SET poi 5 POINT 33.431 -107.0947
package bboxbounds | |
import "math" | |
func BBoxBounds(lat, lon, meters float64) (latMin, lonMin, latMax, lonMax float64) { | |
// see http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates#Latitude | |
lat = lat * (math.Pi / 180) | |
lon = lon * (math.Pi / 180) | |
r := meters / 6371e3 // angular radius |
package main | |
import ( | |
"flag" | |
"fmt" | |
"math/rand" | |
"runtime" | |
"sync" | |
"sync/atomic" | |
"time" |
package main | |
import "net" | |
func main() { | |
ln, err := net.Listen("tcp", ":5000") | |
if err != nil { | |
panic(err) | |
} | |
defer ln.Close() |
package main | |
import ( | |
"fmt" | |
"github.com/tidwall/gjson" | |
) | |
func main() { | |
json := ` |
Standard points
SET poi 1 POINT 34.849 -111.9287
SET poi 2 POINT 32.893 -111.6650
SET poi 3 POINT 36.123 -110.3027
SET poi 4 POINT 35.746 -108.0175
SET poi 5 POINT 33.431 -107.0947
go() { if [[ $@ == "test -cover" ]]; then r="$(command go test -cover)"; if \ | |
[ "$r" != "" ]; then printf "%s\n" "$r"; fi; if [[ "$r" == *"100.0%"* ]]; then \ | |
printf "🎉 \e[1mYou're pretty fucking awesome. Keep that shit up!\e[0m 🎉\n"; \ | |
fi; else command go "$@"; fi } |
package main | |
import ( | |
"github.com/tidwall/gjson" | |
"github.com/tidwall/pretty" | |
) | |
var json = []byte(` | |
{ | |
"type": "Feature", |
Geobin File Format
This format covers the latest GeoJSON at https://tools.ietf.org/html/rfc7946.
It does not support foreign members, and only support 2D and 3D objects.
The entire binary should exist inside a container which already knows it's
size, for example a key value store where the value is the geobin bytes.
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/tidwall/gjson" | |
"github.com/tidwall/sjson" | |
) |
func testOrDie(t testing.TB, fn func() error) { | |
if err := fn(); err != nil { | |
testFatal(t, 1, err) | |
} | |
} | |
func testFatalf(t testing.TB, skip int, format string, args ...interface{}) { | |
if _, file, line, ok := runtime.Caller(skip + 1); ok { | |
msg := fmt.Sprintf(format, args...) | |
t.Fatalf("\r\t%s:%d: %s", filepath.Base(file), line, msg) |