SELECT id, ST_Box2D(areas) AS bbox FROM mytable;
In this example, the table table "mytable" contains two columns: " id " is a unique line identification number and " areas " is a geometry field containing one MULTIPOLYGON for each row.
This is great for multithreads containing only one polygon, but some lines have very polyhedral polygons, so the bounding box does not matter if the polygon contains one polygon in Europe and one in Canada, for example.
So, I need a way to get one box2d per polygon for each multipolygon, but I haven't found it yet. More precisely, my goal is to return one multipolygon per line containing one box2d per polygon.
First example
- id : 123
- area : multipolygon containing only one oval polygon in Australia
- therefore, bbox should return a multipolygon containing only one rectangle (bounding box) in Australia
Second example
- id : 321
- area : multipolygon containing one circle in Paris, one circle in Toronto
- therefore, bbox should return a multipolygon containing one rectangle in Paris, one rectangle in Toronto
source
share