I need to calculate a set of minimum bounding boxes for a polygon. Id est having a complex polygon I want to envelope it with a set of small boxes instead of a big one.
-
I suggest you explain if you are looking for a solution using a particular tool. Also I do not completely understand your question. You want a set of minimum bounding boxes for a (one?) polygon. One polygon can have only one minimum bounding box. Do you want to split that one polygon into several smaller polygons?– ragnvaldCommented Mar 8, 2015 at 9:35
-
Hey, thanks for answering. I'm looking for some open source solution, like geotools or jts. Yes I want to bound just one polygon, but with a number of bounding boxes. When the boxes doesn't intersects and each box cover part of polygon. So yes, the polygon will be splitted into smaller polygons. I need all that to perform geohash indexing on polygons.– leonprouCommented Mar 8, 2015 at 9:49
-
1I suggest you elaborate your question according to our comments. I have provided an answer as well. Please feel also free to make changes to the answer. Your question is initially in the neighbourhood of similar questions posted to GIS Stackexchange. It might very well be that you can find your answer by doing a search here :-)– ragnvaldCommented Mar 8, 2015 at 10:26
2 Answers
I suppose that what you want to do is to create a polygon grid and select all grid cells which intersects the polygon geometry.
If I am right, please reformat your question because it does not make sense as is stands now. By definition a geometry has exactly one bounding box or minimum bounding rectangle as it is also called.
-
I think that finding these cells can be the first step to find the solution. The second step could be to unite cells that form a complete geohash bounding box. I think now I have the answer, though it's different from the question I asked.– leonprouCommented Mar 8, 2015 at 20:48
Most spatial software will allow you to find a bounding box. Using max/min coordinates in lon/lat directions will also make it easy to establish corner coordinates for a bounding box. You will find the answer to this particular challenge using python in QGIS here.
As for splitting it you could use any set of polygons. You could create a fishnet of your choice or use an existing one. Then do an intersect between your bounding box and the fishnet/polygon set you are using.