I have a point layer (shapefile) insert to PostGIS. I'm using MapServer and OpenLayers to display layer on map. Now, I want get lon/lat of all features of the layer.

Hope somebody can help me.

  • 1
    Please clarify your answer. Do you want to get the points in PostGIS or on the web using openlayers ? – Ahsan Mukhtar Aug 8 '17 at 11:14

To extract lon/lat in text format from a database table, you can do something like:

SELECT ST_X(geom), ST_Y(geom) FROM yourgeospatialtable; 

Where geom is the spatially enabled column.

There probably is also an OpenLayers function to do that, but I am not exactly sure where you want to do it (server/client?)

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.