SpatiaLite – Dividing a Polygon into Multiple Different Polygons

spatialite

I have a SpatiaLite dataset (with the projection EPSG:4326) with the following content:

enter image description here

I'd like to find a way of dividing this polygon into multiple smaller polygons… Something like the following:

enter image description here

Is there any way of creating a grid on my polygon and then dividing it into multiple smaller polygons? I've checked the SpatiaLite documentation and I found the SquareGrid function… But if I try running select SquareGrid(GEOMETRY, 0.00001) from dataset, the spatialite-gui interface will crash. I'm probably missing something about how to use this function… Also, I'm not sure if the SquareGrid function will solve my problem as I expect it to be solved. Is it possible to do on SpatiaLite? Can I split a polygon into multiple smaller polygons inside a predefined grid?

Best Answer

If it is not essential to use a regular grid for splitting then the latest SpatiaLite http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html has a function ST_Subdivide for the job. It works in the same way than ST_Subdivide in PostGIS https://postgis.net/docs/ST_Subdivide.html.

Divides geom into many parts until each part can be represented using no more than max_vertices. If the optional argument max_vertices is not explicitly specified a limit of 128 vertices is implicitly assumed. NULL will be returned on invalid arguments.

Related Question