Preferred order of writing latitude & longitude tuples in GIS services

Mikko Ohtamaa picture Mikko Ohtamaa · Sep 5, 2011 · Viewed 61.6k times · Source

When dealing with GIS source code you often need to write latitude and longitude coordinate tuples.

E.g. in Google Maps links (123, 456):

http://maps.google.com/maps/ms?msid=214518704716144912556.00046d7689a99e95b721c&msa=0&ll=123,456&spn=0.007996,0.026865

Which is preferred order (and why?)

  • latitude, longitude

  • longitude, latitude

I have seen both being used in various systems and I hope to find some evidence to stick with other one.

Is there a standard practice, and if so, what is it / what are they?

Answer

Shane picture Shane · Nov 27, 2012

EPSG:4326 specifically states that the coordinate order should be latitude, longitude. Many software packages still use longitude, latitude ordering. This situation has wreaked unimaginable havoc on project deadlines and programmer sanity.

The best guidance one can offer is to be fully aware of the expected axis order of each component in your software stack. PostGIS expects lng/lat. WFS 1.0 uses lng/lat, but WFS 1.3.0 defers to the standard and uses lat/lng. GeoTools defaults to lat/lng but can be overridden with a system property.

The GeoTools docs on the history and explanation of the problem are worth a read: http://docs.geotools.org/latest/userguide/library/referencing/order.html