I have PostGIS database, and want to extract lat, lon pairs sequence from Polygons (and MultiPolygons). As a very fresh PostGIS user, I'm able to just extract the Polygons:

SELECT st_astext("GEOMETRY"::geometry) FROM my_postgisdb;

which outputs Polygons and MultiPoligons.

How should I extract x, y pairs from these structures?

1 Answer 1


You can use ST_DumpPoints to get the points and then ST_AsLatLonText to get nicely readable coordinate output. It doesn't care if the geometries are multi* or not.

Alternatively, you could use ST_Boundary to get the polygon vertices, but you'd need to use ST_Dump first for this to work for multipolygons too.

  • 1
    Can you give a example about how to code it? Commented Mar 24, 2018 at 2:41
  • Hi Did you tried the solution? Commented Apr 20, 2022 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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