Users versus programmers: lon,lat or lat,lon

26 July 2016

Somebody at Mapbox wrote a blog post in which he makes the case that longitude should go first: almost all data formats (including Google’s KML) and all open source software (except Leaflet) use this order. Also, it’s the logical order if you include altitude (XYZ), he argues.

Of course, it can’t be that simple, as this debate on Stack Overflow illustrates. It seems that programmers prefer lon,lat while people who use maps - seafarers, Google Maps users - expect lat,lon. As one commenter puts it:

Good rule of thumb: if you know what a tuple is and are programming, you should be using lon,lat. I would even say this applies if your end user (say a pilot or a ship captain) will prefer to view the output in lat,lon. You can switch the order in your UI if necessary, but the overwhelming majority of your data (shapefiles, geojson, etc.) will be in the normal Cartesian order.

Another good rule of thumb: always check.

26 July 2016 | Categories: data, leaflet, maps