Take the following example from their home page:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands"
}
}
The coordinates field expects longitude and latitude in the first and second indexes respectively of this array. This is confusing to me for the following reasons:
- Longitude and latitude are not the same thing. Representing them in the same list seems illogical from a purely programming perspective however I understand that a list looks like traditional coordinates.
- Human error is more likely with index-based variables in a list rather than accessing them through clearly labelled keys in an object. In fact, after briefly helping someone who is working with Leaflet, ArcGIS and GeoJSON, this exact thing happened. He accidentally swapped round the indexes for accessing longitude and latitude. Furthermore, one of the libraries expected the longitude and latitude to be the opposite way round, leading to further confusion. Even if the keys were differently arranged in an object, this same issue would not occur (unless you accessed the keys via indexes which is possible in some languages I suppose; but this is a bad practice that is generally avoided).
- Regarding performance, in most contexts I expect GeoJSON to be processed in JavaScript via mapping libraries and the likes. Quickly looking at JavaScript arrays and objects, I can find both people claiming it is faster and slower, but either way, the performance difference seems to be not great enough to justify sacrificing semantics.
Is there any reason why this decision was made? What is the advantage of storing them in a list?
Specifications can be found here: https://datatracker.ietf.org/doc/html/rfc7946
csvand forget about a whole convention with long key names (seepropertiesfor example). The performance is questionable. Some benchmarks even claim it to be the other way round so this is also not a reason.longitude/latitude, andLongitude/Latitude, andlong/lat, andlon/lat, andx/yetc