[postgis-users] Cut lat/lon to six decimal digits

pcreso at pcreso.com pcreso at pcreso.com
Tue Apr 16 10:41:21 PDT 2013


Carsten, 

you could try:

SELECT ROW_NUMBER () over () as id, name, 
geom, ST_Y(geom)::decimal(8,6) as lat, ST_X(geom)::decimal(9,6) as lonFROM (SELECT name, (ST_DumpPoints(geom)).* FROM timezones20032013) as foo


Brent Wood

On Tue, Apr 16, 2013 at 8:50 AM, Carsten Hogertz <carsten.hogertz at gmail.com> wrote:

Hi everyone,I've got the following SQL to extract the lat/lon of a polygone:

SELECT ROW_NUMBER () over () as id, name, 
geom, ST_Y(geom) as lat, ST_X(geom) as lon FROM (SELECT name, (ST_DumpPoints(geom)).* FROM timezones20032013) as foo
It gives me back the lat and lon as a number with a lot of digits, e.g.:

42.47349929809571.71096694469452
Instead what I need is:42.4734991.710967
How could I change my SQL to get the result cut/rounded?


Any help would be appreciated.
Thanks in advanceCarsten


_______________________________________________

postgis-users mailing list

postgis-users at lists.osgeo.org

http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users





-----Inline Attachment Follows-----

_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130416/c0c8fc79/attachment.html>


More information about the postgis-users mailing list