Live data from Hacker News

Reverse geocoding is hard

shkspr.mobi

61–70 of 139 posts

Re: Reverse geocoding is hard

#61

Fun fact that was dredged up because the author mentions Australia: GPS points change. Their example coordinates give 6 decimal places, accurate to about 10-15cm. Australia a few years back shifted all locations 1.8m because of continental drift they’re moving north at ~7cm/year). So even storing coordinates as a source of truth can be hazardous. We had to move several thousand points for a client when this happened.

GPS coordinates actually account for the motion of the Earth's tectonic plates. The problem is that it's a highly approximate model that doesn't accurately reflect areas like Australia very well. There's a great visualizer of the coordinate velocity from the Earthscope team: https://www.unavco.org/software/visualization/GPS-Velocity-V...

I'm pretty positive that is showing the reverse, i.e. how much a given "location" is moving using gps coordinates. Not adjusting the gps coordinates to refer to a constant "location".

Re: Reverse geocoding is hard

#62
I dealt with this exact issue and went with that exact solution in my browser based geography game[0].

What the author is looking for is administrative divisions and boundaries[1], in particular probably down to level 3 which is the depth my game goes to. These differ in size greatly by country. With admin boundaries you need to accept there is no one-size-fits-all solution and embrace the quirks of the different countries.

For my game I downloaded a complete database of global admin boundaries[2] and imported them into PostgreSQL for lightning fast querying using PostGIS.

[0] https://guesshole.com

[1] https://en.wikipedia.org/wiki/List_of_administrative_divisio...

[2] https://gadm.org/data.html

Re: Reverse geocoding is hard

#63

I haven't found a better way do this than the Google maps solution [0]: You write a query of all the different kinds of addresses you'd like to display. The query result is a list of valid candidate addresses for the point matching at least one format that you can rank based on whatever criteria you like. [0] https://developers.google.com/maps/documentation/geocoding/r...

It sounds like the author is more interested in getting city or town names from a coordinate. Google maps is massively overkill and horrendously expensive for this use case. I mentioned in another comment I do this in a game I wrote and can complete queries in microseconds.

https://news.ycombinator.com/item?id=43814231

Re: Reverse geocoding is hard

#64
post #19

Earlier quoted context omitted.

In the past year or so I have thought a lot about how to design tables and columns within databases and there is nearly nothing that wouldn't get more robust by adding in a "valid_from" and "valid_till" and make it accept multiple values. Someone's name is Foo ? What if they change it to Bar at some point and you need to access something from before with the old name? If you have only a name field that has a single v…

If you have an "audit" table, where you write a copy of the data before updating it in the primary table, that's a decision you can make at any point. Of course, you don't get that historical data, but you do get it going forward from there.

SQL 2011 defines temporal tables, which few FOSS databases support. I used it in mariadb:

https://mariadb.com/kb/en/temporal-tables/

and if your schema doesn't change much, it's practically free to implement, much easier and simpler than copypasting audit tables, or relying on codegen to do the same.

Re: Reverse geocoding is hard

#65

Fun fact that was dredged up because the author mentions Australia: GPS points change. Their example coordinates give 6 decimal places, accurate to about 10-15cm. Australia a few years back shifted all locations 1.8m because of continental drift they’re moving north at ~7cm/year). So even storing coordinates as a source of truth can be hazardous. We had to move several thousand points for a client when this happened.

GPS coordinates actually account for the motion of the Earth's tectonic plates. The problem is that it's a highly approximate model that doesn't accurately reflect areas like Australia very well. There's a great visualizer of the coordinate velocity from the Earthscope team: https://www.unavco.org/software/visualization/GPS-Velocity-V...

GPS coordinates do not account for tectonic motion. It is a synthetic spheroidal model that is not fixed to any point on Earth. The meridians are derived from the average motion of many objects, some of which are not on the planetary surface.

The motion of tectonic plates can be calculated relative to this spatial reference system but they are not part of the spatial reference system and would kind of defeat the purpose if they were.

Re: Reverse geocoding is hard

#66
This is a while ago but about 12 years ago I experimented with putting the whole of openstreetmap into Elasticsearch.

Reverse geocoding then becomes a problem of figuring out which polygons contain the point with a simple query and which POIs/streets/etc. are closest based on perpendicular distance. For that, I simply did a radius search and some post processing on any street segments. Probably not perfect for everything. But it worked well enough. My goal was actually being able to group things by neighborhood and microneighborhoods (e.g. squares, nightlife areas, etc.).

This should work well enough with anything that allows for geospatial queries. In a pinch you can use geohashes (I actually did this because geospatial search was still a bit experimental in ES).

Re: Reverse geocoding is hard

#67
post #29

Fun fact that was dredged up because the author mentions Australia: GPS points change. Their example coordinates give 6 decimal places, accurate to about 10-15cm. Australia a few years back shifted all locations 1.8m because of continental drift they’re moving north at ~7cm/year). So even storing coordinates as a source of truth can be hazardous. We had to move several thousand points for a client when this happened.

Can this be solved by storing a timestamp of the record along with precise GPS coordinates? Could we then utilize some database to compute the drift from then and now?

[deleted]

Re: Reverse geocoding is hard

#68
post #12

I read this as Reverse Genociding Is Hard, thought I was on a Nethack forum, and thought, No, it's pretty easy with a cursed scroll.

At least one spellcheck software likes to correct genocide to geocode. On social media I saw rage posts how Jews and Palestinians are being geocoded.
Post reply on HN