paulmach / orb

Types and utilities for working with 2d geometry in Golang
MIT License
910 stars 103 forks source link

From Polygon to Tile - and back again #54

Closed glagnar closed 4 years ago

glagnar commented 4 years ago

I am trying to use your code to use your code to split a Geometry ( Polygon ) into smaller roughly equally sized Polygons.

My plan was to convert the polygon to tiles, divide the tiles as many sets as I need, and then go back to a polygon finding the edges of the new shapes.

Going from polygon to tiles, and splitting them works fine, but going back seems not to be as easy. I have merged the new polygons, and could perhaps use the centre point of each tiles as edges of the new polygon - but I am not sure about the importance of the ordering of the points.

Any tips ?

glagnar commented 4 years ago

I have made it work. Some libraries have an envelope function to do this, perhaps that could be considered for this library as well ?