Thursday, 12 April 2018

postgis - Polygons have holes after pgr_pointsAsPolygon


I calculate a 500m Isochrones with pgr_drivingDistance and after that use pgr_pointsAsPolygon to create the Isochrones out of the resulting nodes.


SELECT * FROM pgr_pointsAsPolygon('SELECT id,x,y FROM Calc_nodes')

Sadly in some case the Dijkstra algorithm create holes in the resulting poylgons. I know the reason for this is the nature of the network and how the algorithm works.


I just need function to check if there are holes and then get rid of them. Any suggestions?



enter image description here



Answer



Try


SELECT ST_MakePolygon(ST_ExteriorRing()) AS geom
FROM

to process all polygons, or


SELECT CASE
WHEN ST_NRings() > 1
THEN ST_MakePolygon(ST_ExteriorRing())

ELSE
END AS geom
FROM

to only process those with an interior ring.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...