So, I came across this relevant question, but I think my problem is a bit different.
I have two tables i.e. polygon
poly and points
pts in my Postgres db. I am on Windows 10 (x64) based machine and using PostgreSQL 9.5.12/PostGIS 2.3. Some of the polygons contain points inside them while, some do not. The sample scenario is given as follows:
poly, the following query computes the area and counts number of
pts inside polygon.
Select a.gid poly_id, count(b.geom) pt_cnt, st_area(a.geom)::int poly_area FROM poly a LEFT JOIN pts b ON st_contains(a.geom, b.geom) GROUP BY a.gid Order by a.gid;
The area of the polygons (from left to right) is 1079, 744, 340 meter-square respectively. Now, I would like to split these polygons' geometry based on the area i.e. if area is above 100 meter-square, then each polygon needs to be divided/split into approximate equal parts. Can somebody suggest me a workaround to fix the issue?
Here, is another example of the polygons in my data. I am aware that there can be much more complex examples (e.g. irregular polygons). In that case, I think exceptions can be added.