This project is read-only.

asWKT and asGML co-ordinate order

Topics: User Forum
Jan 17, 2008 at 12:48 PM
The intention of this post is to seek clarity on this, mostly because it seems to have become an issue with the release of the CTP of SQL Server 2008.

There's been a lot of discussion over on the SQL 2008 forum around the order in which co-ordinates are provided in the as WKT format. see

The current CTP release of SQL2008 has WKT returning co-ordinates as (x,y) ie lat,long. This is counter to all existing providers including MsSqlSpatial which return co-ordinates (y,x) ie long,lat . In response to community pressure Microsoft have pledged to conform in a later release and return (y,x) ie long,lat.

However the pledge also indicates that SQL Server 2008 will return asGML as (x,y) ie lat,long beacuse "both in theory and practise appears to use a latitude-longitude ordering". This runs counter to my understanding of GML and what from my expirence MsSqlSpatial returns with asGML.

Within "practise" the major exception to long,lat I see to the use of GeoRSS which uses lat,long.

Can someone please check I've got this right!

Many thanks
Jan 19, 2008 at 9:35 AM
Well you pretty much consistently swapped X and Y in the above. WKT and WKB uses X,Y, not Y,X as you wrote. You can say that Longitude corresponds to X and Latitude to Y.

With regards to GML, it is correct that the ordering is based on the SRID (so it can actually both be lat/long and lon/lat depending on the SRID, and this goes for X,Y as well). Whether this is a smart choice is a completely different discussion, and unfortunately it's already stated like this in the spec, so there's nothing much we can do about that. That's just how OGC made it.
Feb 1, 2008 at 5:36 PM
Thanks for the reply - I was looking for some to check my thoughts - I've got it and I'm eating a large slices of XY humble pie...or is that YX.... :-)