This doesn't stress the datum point quite enough. If you have an arbitrarily precise lat long, you still don't know where you are very well.
If you don't know the datum of a lat long, you only know the location to within about a kilometer.
Datum matters. And yes, WGS84 is fairly common, but you will still very routinely come across lat/long or projected coordinates in other datums. NAD27 is the one that you'll encounter the most in the US, and it's about a 300 meter shift compared to WGS84 or NAD83. Others exist too and are frequently used.
A few years ago, I visited the Greenwich Observatory and waited in line for hours to get a photo on the prime meridian. To my surprise, its GPS coordinates were not at 0 degrees longitude. It turns out that while older datums such as NAD27 use the Greenwich meridian, GPS is based on WGS84 which uses the IERS Reference Meridian. It runs through the park about 100 meters away from the observatory (and you can stand on it without waiting in line at all!)
I did a Google map of US car dealerships for a former employer. When zoomed out dealerships would be clustered together using a modified k-means clustering. I had to do a lot of non-trivial coding to handle the variance in how latitude is distorted in Alaska vs the continental US. To this day, that was the algorithmically most interesting coding that I've done.
You just need "distance" in the k means to be more general than just using the euclidean distance between coordinates, you need a norm appropriate for the space you are working in. Haversine distance should be fine for this application.
I don't remember exactly what I did or how it maps to spherical k-means. One modification was to use a version of the k-means algorithm but doing clustering not by fixed size but by fixed distance. The other was measuring distance by what the map coordinates would be rather than the lat/long coordinates. The last thing was rather than using a euclidean distance which gives circular neighborhoods, we used max(∆x, ∆y) which gives square neighborhoods. Clusters were pre-calculated or else we would have made rectangular neighborhoods with the proportions of the viewport window on the map. In retrospect, it might have made sense to do client-side clustering for more detailed zoom levels where n would have been relatively small and we could have gotten that as well.
An extreme example of the consequences of #7 is the Lake Peigneur disaster, where "an engineer mistook transverse Mercator projection coordinates for UTM coordinates" and Texaco, drilling for oil, drilled into a salt mine that was under the lake. The lake drained into the mine (which had 55 workers, all survived), the canal that normally drains the lake into the ocean reversed until the mine filled up and reversed again, and the lake changed from freshwater to saltwater.
I was living in Sydney a couple years ago and frequently found GPS/Google Maps to be a lot less reliable on my phone compared to Canada. It would frequently jump over a street or say I'd taken a turn which I hadn't. I assumed this had something to do with a more dense city, bigger buildings, etc.
Then one day, they moved the official location of the city[0] and, as far as I can tell, the problem went away overnight.
It's more than just that! The Australian plate is moving so fast that calculations relative to GPS coordinates need to factor in the current date. All other plates are moving slowly enough that this can be ignored, so of course... it's ignored by map vendors. They all use fixed, static coordinates with any temporal effects factored in.
Also, China makes very accurate maps illegal, and beyond a certain level of precision, there is an asymmetry between Coords->Place and Place->Coords, due to a munging operation they require for maps.
When I worked at HERE Maps, a colleague of mine was working on censorship for South Korean maps. You were not supposed to access them from outside of South Korea. There were also places where you saw different borders according to your own location.
I worked for a hotel startup once. When Russia annexed Crimea, it was all hands on deck to make sure Russian users/stakeholders (hotel owners) see Crimea as part of Russia and Ukrainian users/stakeholders see Crimea as part of Ukraine. IP based geotargeting is a bitch.
More than lat/long and UTM coordinates, there are many unique coordinate systems that are sometimes used for quite small jurisdictions. For example, EPSG:7595 is valid Chippewa County, Wisconsin [0].
A big gotcha with some of these systems, in addition to the datum, is the units of measure. Some are in metres while many in the US use ft.
I'm confused about the use of "in the Mercator projection" in #4:
> In the Mercator projection, the Earth - which, in reality, is an oblate spheroid - is projected as a simple cylinder. This means that "parallel" longitude lines meet at the poles, so the distance between degrees of longitude are much shorter as they get closer to the poles than they are at the equator (~111 km).
Latitude and longitude are defined on the globe, not by any particular projection, and the fact that longitude lines meet at the poles is true on the globe. A projection may or may not make them appear to be parallel. No projection is responsible for, or will change, the fact that a degree of longitude as an arc on the Earth's surface varies in length from (Earth's equatorial circumference)/360 at the equator to 0 at the poles.
The Mercator projection models the earth as a cylinder. I think the association here is just that people are most familiar with the coordinate grid as represented on the Mercator projection, which creates the illusion that lines of longitude are parallel. This illusion is all the stronger because it makes spherical coordinates look like the more familiar cartesian plane, which would tend to be most people's first intuition before remembering that the planet is roughly spherical.
The situation is even a bit worse in marine or air navigation because the nautical mile is (or more accurately was) defined by a minute of latitude, which is nearly consistent across the globe and creates the temptation to measure along longitude the same way. In reality nautical and aviation charts have to use a specific conical projection to keep this naive way of measuring distances approximately accurate.
Aha, that makes perfect sense. It's not suggesting that the underlying property is only true of the Mercator projection, but that people are most likely to be confused by that property when they think in terms of the Mercator projection.
> because the nautical mile is (or more accurately was) defined by a minute of latitude
Cool, I've heard that in the past but somehow always forget about it!
You have: (arcminute/circle) earthradius * two pi
You want: nauticalmile
* 1.0006759
/ 0.9993246
I’ve seen something similar to this, but about “Names”. One was the assumption that most people have a First, Middle, and Last Name. Some cultures have more or fewer names for an individual.
I think a Github repo or YouTube Playlist of “Falsehoods Programers Believe About______” would be very entertaining and informative.
This is the only right answer. If you feel yourself starting to slice up your name field, ask, "what am I going to do with the parts?" 90% of the time the answer is to also record a nickname.
> I’ve seen something similar to this, but about “Names”.
I believe that's the Ur "Falsehoods Programmers Believe About" article. Sort of like Dijkstra's "Go To Statement Considered Harmful" is the progenitor of all the following "Considered Harmful" titles.
Also check out Falsehoods Programmers Believe About Time. This gave a good laugh to me (programmer) and my colleague (tester), writing software for GPS vehicle tracking!
After going to GIS school, I once wrote an email to a homeschooling list and may have titled it "Georgia is an imaginary place."
There are a great many problems with trying to depict a three-dimensional world in 2D, which is what maps do. There are many different projections that get used for different reasons and it depends in part on which part of the earth you are trying to depict, how much of it you are trying to depict and what information you are trying to effectively convey.
GIS is fascinating stuff and it's just sad that I never got to work in it after getting my certificate in GIS.
Interesting. Though I did a web app for a single city event with 100 locations. I did the "distance to my current location" calculation without taking the curve into account, and it worked fine for that small area.
Also determined that 0,0 is located on the equator off africa south of england (kinda obvious in hindsite).. Which means you probably should make sure all your locations are geotagged before including on a map...
This is a property of the small angle law; the great circle is only appreciably different to a “straight” Mercator path on the scale of a flight spanning a European country or two.
For some reason I remembered this point being somebody's house that got a lot of unwanted visitors due to the coincidence. Was there something similar like that?
This is why you need both a location and a certainty when giving back geotagged info, and when you get it, you don't display a point, you display an appropriately sized circle.
So you get something that actually resolves to "US", you draw a circle centered on the US, covering most of the US, instead of a point marker in the middle of the US.
Often, when a database entry is geotagged with a country, province, or city, trying to plot that entry on a map will result in a marker being drawn at the exact geometric centre of the region, implying more precision than actually exists. When the database entry represents something important to people, like stolen property or a missing person, and something happens to be at the place the map marker lands, desperate people can do desperate things.
If one disables JavaScript, the site goes kablammo as all the text is unreadable. And, of course, the page doesn't need JavaScript. Thanks but no thanks.
This doesn't stress the datum point quite enough. If you have an arbitrarily precise lat long, you still don't know where you are very well.
If you don't know the datum of a lat long, you only know the location to within about a kilometer.
Datum matters. And yes, WGS84 is fairly common, but you will still very routinely come across lat/long or projected coordinates in other datums. NAD27 is the one that you'll encounter the most in the US, and it's about a 300 meter shift compared to WGS84 or NAD83. Others exist too and are frequently used.
Don't just record lat/long.
A few years ago, I visited the Greenwich Observatory and waited in line for hours to get a photo on the prime meridian. To my surprise, its GPS coordinates were not at 0 degrees longitude. It turns out that while older datums such as NAD27 use the Greenwich meridian, GPS is based on WGS84 which uses the IERS Reference Meridian. It runs through the park about 100 meters away from the observatory (and you can stand on it without waiting in line at all!)
I did a Google map of US car dealerships for a former employer. When zoomed out dealerships would be clustered together using a modified k-means clustering. I had to do a lot of non-trivial coding to handle the variance in how latitude is distorted in Alaska vs the continental US. To this day, that was the algorithmically most interesting coding that I've done.
Spherical kmeans is your friend there. It's overkill in a lot of cases, but perfect for that one.
You just need "distance" in the k means to be more general than just using the euclidean distance between coordinates, you need a norm appropriate for the space you are working in. Haversine distance should be fine for this application.
Yes, but that's harder to implement.
Spherical kmeans is much simpler. A simple cos distance between vectors.
I don't remember exactly what I did or how it maps to spherical k-means. One modification was to use a version of the k-means algorithm but doing clustering not by fixed size but by fixed distance. The other was measuring distance by what the map coordinates would be rather than the lat/long coordinates. The last thing was rather than using a euclidean distance which gives circular neighborhoods, we used max(∆x, ∆y) which gives square neighborhoods. Clusters were pre-calculated or else we would have made rectangular neighborhoods with the proportions of the viewport window on the map. In retrospect, it might have made sense to do client-side clustering for more detailed zoom levels where n would have been relatively small and we could have gotten that as well.
An extreme example of the consequences of #7 is the Lake Peigneur disaster, where "an engineer mistook transverse Mercator projection coordinates for UTM coordinates" and Texaco, drilling for oil, drilled into a salt mine that was under the lake. The lake drained into the mine (which had 55 workers, all survived), the canal that normally drains the lake into the ocean reversed until the mine filled up and reversed again, and the lake changed from freshwater to saltwater.
https://en.wikipedia.org/wiki/Lake_Peigneur
I was living in Sydney a couple years ago and frequently found GPS/Google Maps to be a lot less reliable on my phone compared to Canada. It would frequently jump over a street or say I'd taken a turn which I hadn't. I assumed this had something to do with a more dense city, bigger buildings, etc.
Then one day, they moved the official location of the city[0] and, as far as I can tell, the problem went away overnight.
[0] https://www.smh.com.au/national/nsw-and-victoria-just-jumped...
It's more than just that! The Australian plate is moving so fast that calculations relative to GPS coordinates need to factor in the current date. All other plates are moving slowly enough that this can be ignored, so of course... it's ignored by map vendors. They all use fixed, static coordinates with any temporal effects factored in.
Wow, TIL.
Plate movement is mentioned in the original article, but more detail on how Australia is dealing with "drifting at about seven centimetres a year to the northeast" here [2017]: https://theconversation.com/australia-on-the-move-how-gps-ke...
Also, China makes very accurate maps illegal, and beyond a certain level of precision, there is an asymmetry between Coords->Place and Place->Coords, due to a munging operation they require for maps.
When I worked at HERE Maps, a colleague of mine was working on censorship for South Korean maps. You were not supposed to access them from outside of South Korea. There were also places where you saw different borders according to your own location.
I worked for a hotel startup once. When Russia annexed Crimea, it was all hands on deck to make sure Russian users/stakeholders (hotel owners) see Crimea as part of Russia and Ukrainian users/stakeholders see Crimea as part of Ukraine. IP based geotargeting is a bitch.
It's not illegal, you just need to be a Chinese entity and pay.
The most useful falsehood list is the following:
https://kevin.deldycke.com/2016/12/falsehoods-programmers-be...
More than lat/long and UTM coordinates, there are many unique coordinate systems that are sometimes used for quite small jurisdictions. For example, EPSG:7595 is valid Chippewa County, Wisconsin [0].
A big gotcha with some of these systems, in addition to the datum, is the units of measure. Some are in metres while many in the US use ft.
0. http://epsg.io/7595
And many in the US don't use the international foot (10000ft=3048m) but the 1866 US foot (12000ft=3937m).
>3. LATITUDE ALWAYS COMES BEFORE LONGITUDE IN A COORDINATE PAIR
This has bitten me so many times, that I just default to named structs instead of pairs
A previous coworker of mine had a sticky note with "LONGITUDE FIRST, LATITUDE SECOND" (or something to that effect) stuck to the wall in her office.
And if you run into problems dealing with coordinate systems, check out https://ihatecoordinatesystems.com/
I'm confused about the use of "in the Mercator projection" in #4:
> In the Mercator projection, the Earth - which, in reality, is an oblate spheroid - is projected as a simple cylinder. This means that "parallel" longitude lines meet at the poles, so the distance between degrees of longitude are much shorter as they get closer to the poles than they are at the equator (~111 km).
Latitude and longitude are defined on the globe, not by any particular projection, and the fact that longitude lines meet at the poles is true on the globe. A projection may or may not make them appear to be parallel. No projection is responsible for, or will change, the fact that a degree of longitude as an arc on the Earth's surface varies in length from (Earth's equatorial circumference)/360 at the equator to 0 at the poles.
The Mercator projection models the earth as a cylinder. I think the association here is just that people are most familiar with the coordinate grid as represented on the Mercator projection, which creates the illusion that lines of longitude are parallel. This illusion is all the stronger because it makes spherical coordinates look like the more familiar cartesian plane, which would tend to be most people's first intuition before remembering that the planet is roughly spherical.
The situation is even a bit worse in marine or air navigation because the nautical mile is (or more accurately was) defined by a minute of latitude, which is nearly consistent across the globe and creates the temptation to measure along longitude the same way. In reality nautical and aviation charts have to use a specific conical projection to keep this naive way of measuring distances approximately accurate.
Aha, that makes perfect sense. It's not suggesting that the underlying property is only true of the Mercator projection, but that people are most likely to be confused by that property when they think in terms of the Mercator projection.
> because the nautical mile is (or more accurately was) defined by a minute of latitude
Cool, I've heard that in the past but somehow always forget about it!
Thanks!
I’ve seen something similar to this, but about “Names”. One was the assumption that most people have a First, Middle, and Last Name. Some cultures have more or fewer names for an individual.
I think a Github repo or YouTube Playlist of “Falsehoods Programers Believe About______” would be very entertaining and informative.
Does such a resource exist?
https://github.com/kdeldycke/awesome-falsehood
Time to make names linked lists instead of arrays.
Mostly kidding but not entirely.
Or it can just be a single string of arbitrary length.
This is the only right answer. If you feel yourself starting to slice up your name field, ask, "what am I going to do with the parts?" 90% of the time the answer is to also record a nickname.
Names: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-...
As far as I know, that was the first one.
> I’ve seen something similar to this, but about “Names”.
I believe that's the Ur "Falsehoods Programmers Believe About" article. Sort of like Dijkstra's "Go To Statement Considered Harmful" is the progenitor of all the following "Considered Harmful" titles.
Also check out Falsehoods Programmers Believe About Time. This gave a good laugh to me (programmer) and my colleague (tester), writing software for GPS vehicle tracking!
https://infiniteundo.com/post/25326999628/falsehoods-program...
After going to GIS school, I once wrote an email to a homeschooling list and may have titled it "Georgia is an imaginary place."
There are a great many problems with trying to depict a three-dimensional world in 2D, which is what maps do. There are many different projections that get used for different reasons and it depends in part on which part of the earth you are trying to depict, how much of it you are trying to depict and what information you are trying to effectively convey.
GIS is fascinating stuff and it's just sad that I never got to work in it after getting my certificate in GIS.
Interesting. Though I did a web app for a single city event with 100 locations. I did the "distance to my current location" calculation without taking the curve into account, and it worked fine for that small area.
Also determined that 0,0 is located on the equator off africa south of england (kinda obvious in hindsite).. Which means you probably should make sure all your locations are geotagged before including on a map...
This is a property of the small angle law; the great circle is only appreciably different to a “straight” Mercator path on the scale of a flight spanning a European country or two.
https://en.wikipedia.org/wiki/Null_Island
For some reason I remembered this point being somebody's house that got a lot of unwanted visitors due to the coincidence. Was there something similar like that?
You're probably thinking about https://www.washingtonpost.com/news/morning-mix/wp/2016/08/1... which is about the maxmind geoip database using a specific coordinate for when they don't know anything more accurate than "United States"
This is why you need both a location and a certainty when giving back geotagged info, and when you get it, you don't display a point, you display an appropriately sized circle.
So you get something that actually resolves to "US", you draw a circle centered on the US, covering most of the US, instead of a point marker in the middle of the US.
Often, when a database entry is geotagged with a country, province, or city, trying to plot that entry on a map will result in a marker being drawn at the exact geometric centre of the region, implying more precision than actually exists. When the database entry represents something important to people, like stolen property or a missing person, and something happens to be at the place the map marker lands, desperate people can do desperate things.
If one disables JavaScript, the site goes kablammo as all the text is unreadable. And, of course, the page doesn't need JavaScript. Thanks but no thanks.