4 ms·
GeoJSON decision to use Long, Lat instead of Lat, Long partly to blame here. It's not what any new user expects. I suspect there are plenty of other bugs lurkin
by fredley 4y ago
GeoJSON decision to use Long, Lat instead of Lat, Long partly to blame here. It's not what any new user expects. I suspect there are plenty of other bugs lurking out there due to people making the same mistake.
- FL410 4y agoI am trying to understand the rationale behind this. Is there some industry or region where Long, Lat is the customary way of representing a location? I have never seen that before.
- leeoniya 4y ago3 months ago: https://news.ycombinator.com/item?id=30228981 https://news.ycombinator.com/item?id=30228981
- xioxox 4y agoAstronomy usually writes coordinates in this order, for example: Right ascension [RA], declination [Dec] in the equatorial coordinate system (corresponding to Long, Lat), or Galactic sky coordinates l (Galactic longitude) and b (Galactic latitude).
- sampo 4y ago> I am trying to understand the rationale behind this. Is there some industry or region where Long, Lat is the customary way of representing a location? Historically, cartography was Lat,Long (1). Then software developers took over, and their natural mode of thinking inherits from thinking in x,y coordinates in 2d-graphics on the computer screen, so Long,Lat started to dominate in software. And now software dominates everything. Here's a take on the history: http://docs.geotools.org/latest/userguide/library/referencing/order.html http://docs.geotools.org/latest/userguide/library/referencin... (1) This is from 1983, but the Lat,Long practice is much older https://en.wikipedia.org/wiki/ISO_6709 https://en.wikipedia.org/wiki/ISO_6709
- rozza 4y agoThe world is used to x,y for coordinates which sets the convention.
- fredley 4y agoIn a cartesian plane yes. However for geospatial it's Lat/Long everywhere except in GeoJSON it seems.
- jandrewrogers 4y agoGeospatial is pervasively Lon/Lat and has been the standard for decades across virtually every software system. GeoJSON is in the correct order, same order as every other common industry format for geospatial. There are similar conventions for polygon winding order, whether a polygon is closed or not, etc which new users frequently ignore. To someone that works with geospatial data, this is like asserting that RGB is the wrong order for specifying color, ignoring that approximately everyone in industry has been using this ordering convention for a very long time.
- egl2021 4y agoOpenCV uses BGR.
- jandrewrogers 4y agoHeh, I did not know that.
- dekhn 4y agoIt also uses y first indexing
- indymike 4y agoIt is usually not the end applications that get it backwards, it's usually a library somewhere in the toolchain that bites you where the author wrote code before learning there are conventions for these things.
- jandrewrogers 4y agoGeoJSON made the correct decision because it conforms with ISO 19125, just like every other data format for the last couple decades. Same reason PostGIS is in Lon/Lat order. Virtually all geospatial data that exists is formatted this way. If you are not sufficiently familiar with geospatial data to know this, then you probably shouldn't be assuming the order. It behooves the new user to learn the industry standards and conventions instead of inventing their own.
- NelsonMinar 4y agoIt's exactly what people with GIS experience expects. It's X, Y ordering. See also: WKT. The problem is GeoJSON is often used by folks with no other geospatial experience and lat, lon is colloquially the more common ordering. But that's all about casual use. If someone's job is to write geospatial code for a database driver, it's a bare minimum to expect they'd pay attention to making this work right. Also to have a test suite to verify it's working right. (When I write code I always put in a little check on inputs to display a very clear error message if it sees a "latitude" outside the range [-90, 90]. Won't catch all bad data but sure can help.)
- tmcw 4y agoVirtually every geospatial format uses longitude latitude order. WKT, WKB, GeoJSON, KML, Shapefiles, FlatGeobuf, Geobuf, you name it. Your data in PostGIS? Longitude, Latitude. Google Earth? Same. If you're storing data in a standardized format, odds are it's longitude, latitude. If your starting guess is the opposite, you will almost always be wrong.
- perrygeo 4y agoAnyone with a basic math or science background is intimately familiar with (x, y) coordinate ordering on a cartesian plane, where the horizontal component comes before the vertical. From that perspective (Long, Lat) is the only obvious ordering; and geospatial software has used it by convention for decades. There are thousands of different projections and spatial reference systems and they all use X, Y ordering. Why would you create a special case just for one? Now you could make the case that Longitude and Latitude are NOT cartesian coordinates and thus not beholden to the x,y convention. Fair point, but we still encode it as a pair of coordinates as if it were a 2D reference system (technically the Platte Carre projection) like any other. Switching the coordinate order feels like a strange hill to die on - again, why a special case? In any case, it's wildly inaccurate to place the blame on GeoJSON which was just following the widely held, and mathematically consistent, convention.
- dekhn 4y agoI work with plenty of systems that put y first. Like opencv. Of the Geo software I've used about 30% of them put lat first. It's one of the things I most commonly spent debugging
- perrygeo 4y agoI guess there is really no "obvious" ordering, it all depends on your past experience. Named data structures are a way around it, but coordinates represented as tuples/lists/arrays seems cursed to repeat this mistake.