Wednesday, 4 October 2017

convert - Getting coordinates from geometry in PostGIS?


This line:


SELECT geom FROM myLayer.geom

will return a hex value.


How would I get decimal values, which is a human-readable coordination?



Answer



In addition to ST_AsText (which returns geometry as WKT / Well Known Text), there are several additional output formats, like ST_AsGeoJSON().



Take a look in http://postgis.net/docs/manual-2.0/reference.html#Geometry_Outputs and choose, what fits your needs best.


No comments:

Post a Comment