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

  • pgr_pointsAsPolygon functional also has an optional 3rd parameter, the alpha value, which may affect, if you have wholes or not: docs.pgrouting.org/latest/en/… You could play with the value and see, if it returns better results for you.
    – dkastl
    Apr 5 '18 at 3:44


SELECT ST_MakePolygon(ST_ExteriorRing(<pgr_polygon_geometry>)) AS geom
FROM <your_query>

to process all polygons, or

         WHEN ST_NRings(<pgr_polygon_geometry>) > 1
         THEN ST_MakePolygon(ST_ExteriorRing(<pgr_polygon_geometry>))
         ELSE <pgr_polygon_geom>
       END AS geom
FROM <your_query>

to only process those with an interior ring.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.