[postgis-users] lat,lon or lon,lat in WGS84 WKT

Paul Ramsey pramsey at cleverelephant.ca
Tue Nov 17 09:08:49 PST 2015


We Leave It To You, in that the ordering in the WKT will be reflective
of the ordering you've stored your data in.
However.
If you want to reproject or do any other Nice Things with your data,
store it in X/Y order. Otherwise you'll need a special spatial_ref_sys
entry for your data that indicates the axis ordering you've chosen,
using the +axis proj4 argument.
http://gis.stackexchange.com/questions/6221/how-can-i-specify-a-proj-4-projection-with-the-north-pointing-down
By default we assume data in SRID 4326 (and other spherical systems)
are X/Y ordered.
P


On Tue, Nov 17, 2015 at 7:09 AM, Willy-Bas Loos <willybas at gmail.com> wrote:
> Hi,
>
> I have a couple of questions about the order of lattitude and longitude in
> WKT representations of geometries:
>
> Is there an objective reference that states in what order WGS84 (geographic)
> coordinates should be represented in a WKT? Is it lon, lat (because of x,y)
> or lat,lon (because it's geodetic) ?
> Does postgis use the correct representation?
> Is there a way to switch lat and lon for a polygon when representing as WKT?
> All i think of is looping through all points, switching x and y and then
> returning astext(g)
>
> Cheers,
>
> --
> Willy-Bas Loos
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users


More information about the postgis-users mailing list