tile38/vendor/github.com/tidwall/geojson/circle_test.go

23 lines
605 B
Go
Raw Normal View History

package geojson
import "testing"
func TestCircle(t *testing.T) {
2018-10-16 18:55:26 +03:00
expectJSON(t,
`{"type":"Feature","geometry":{"type":"Point","coordinates":[-112,33]},"properties":{"type":"Circle","radius":"5000"}}`,
`{"type":"Feature","geometry":{"type":"Point","coordinates":[-112,33]},"properties":{"type":"Circle","radius":5000,"radius_units":"m"}}`,
)
g, err := Parse(`{
"type":"Feature",
"geometry":{"type":"Point","coordinates":[-112.2693,33.5123]},
"properties": {
"type": "Circle",
"radius": 1000
}
}`, nil)
if err != nil {
t.Fatal(err)
}
2018-10-16 18:55:26 +03:00
expect(t, g.Contains(PO(-112.26, 33.51)))
}