Create polygon from lines in PostGIS

المشرف العام

Administrator
طاقم الإدارة
I'm trying to divide a polygon in smaller polygons from a line, but I think I can't use the st_split function. What I need is to create small polygons inside a big one, using linestring grid.

I've tried some ways, but I can't get the result. What I've tried:

Divide one polygon from a LineString using st_split()

From a boundary polygon.



And Linestring table:



I'd need the following polygons:



Problem: I cant Split a polygon from several lines, neither a polygon from a multilinestring.

The other method I'm trying is to create a polygons from the lines with st_polygonize() The SQL I was trying is:

SELECT g.path[1] as gid, g.geom::geometry(polygon, 22033) as geom FROM (SELECT (ST_Dump(ST_Polygonize(geom))).* FROM linestable ) as g; Extracted from Creating polygons from line segments using PostgreSQL and PostGIS

Problem: I can only get one polygon (the boundary).

Can someone tell me which would be the best way to get the polygons from the linestring, or if am I missing somthing?

Note: Tables are in the same SRID, and geometries are snapped into a grid. In QGIS I can run the polygonize process from lines to polygon perfectly.



أكثر...
 
أعلى