Twitter GeoJSON Error

Sean Gillies pointed out on Twitter today that the GeoJSON output of coordinates from Twitter’s just-released geolocation capability is wrong. Sean is one of the authors of the spec so, when I saw his tweet, I took notice. According to the Twitter documentation:

The XML response uses GeoRSS to encode the latitude and longitude. encodes as latitude, space, and longitude (see the response below for an example). For JSON the response uses conventions laid forth in GeoJSON which looks like

“coordinates”:[37.78029, -122.39697]

You will notice that this is in Latitude/Longitude order whereas the GeoJSON specification clearly states Longitude/Latitude.

This is clearly an error that will throw off any existing software that has been developed to handle GeoJSON. This is somewhat reminiscent of a similar issue with early versions of SQL Server 2008, with a lot of the same issues applicable here. The main difference this time around being that the GeoJSON spec is much clearer on X/Y ordering than the WKT spec was.

There seem to be a lot of clients already on board with supporting geolocation in Twitter so this could be a potentially large proliferation of this particular GeoJSON error. Twitter should look at correcting this before a lot of data gets out there.

Good catch, Sean. And, yes, it should have been noticed before now. Maybe we should look up from our iDroidBerries more often.