tidwall / geojson

GeoJSON for Go. Used by Tile38
MIT License
130 stars 28 forks source link

Add RequireValid option and add Valid() to geom types #5

Closed stephenlacy closed 5 years ago

stephenlacy commented 5 years ago

This adds config ParseValid default: false and func Valid() to the geometry types. I added a WorldPolygon variable, not sure if you want to handle the max bounds differently. https://github.com/tidwall/geojson/compare/master...stevelacy:requirevalid?expand=1#diff-a62196bce3504b8d6a6c3a50de13fe73R26

I added test cases for all but the circle. I think this is how you would validate it? https://github.com/tidwall/geojson/compare/master...stevelacy:requirevalid?expand=1#diff-05508f93f36c3b0526f44f64f7f8a39aR183

tidwall commented 5 years ago

This a good start. I can see more capabilities in the future.

https://postgis.net/docs/ST_IsValid.html