https://shkspr.mobi/blog/2025/04/reverse-geocoding-is-hard/ Photo of Terence Eden. He has a beard and is smiling. Terence Eden's Blog Mastodon. LinkedIn. GitHub. Email. Feed. [?] Theme: [ / ] 2025-04-25 Reverse Geocoding is Hard @edent [a] geolocation geotagging OpenBenches * 7 comments * 850 words * Viewed ~17,337 times. --------------------------------------------------------------------- My wife and I run OpenBenches - a crowd-sourced database of nearly 40,000 memorial benches. Every bench is geo-tagged with a latitude and longitude. But how do you go from a string of digits to something human readable? How do I turn -33.755780,150.603769 into "42 Wallaby Way, Sydney, Australia"? Luckily, that's a (somewhat) solved problem. Services like OpenCage, StadiaMaps, OpenStreetMap, and Geocode.Earth all provide APIs which transform co-ordinates into addresses. Done! Let's go home. Except... Not everywhere has an address. Some benches are in parks. They typically don't have a street number, but might have an interesting feature nearby to help with location. For example a statue or prominent landmark. And... Not every address is relevant. Some benches are on streets. But we probably don't want to imply that the bench is inside or belongs to a specific nearby house. Let's step back a bit. Why do we want to display a human-readable address? We have two use-cases. "As a visitor to the site, I want to:" 1. Read a (rough) textual representation of where the bench is. 2. Click on a component of the address to see all benches within that area. The first is easy to explain: Map. Under it is an address of "Middlewich, Cheshire East, England, United Kingdom". The second is harder. Suppose a bench is in Wellington, New Zealand. We want to create a URl like openbenches.org/location/New Zealand/ Wellington/. That way, users can click on the word "Wellington" and find all the benches nearby. A user can also manually edit that URl to increase or decrease precision. Both of these are problems of precision. Let's take a look at how one of the reverse geocoding services deals with transforming 51.476845,-0.295296 into an address: Royal Botanic Gardens, Kew, Sandycombe Road, Kew, London Borough of Richmond upon Thames, London, Greater London, England, TW9 2EN, United Kingdom That is too much address! Yes, it is technically accurate. But it contains far too much detail for humans, the postcode is irrelevant, and the weird-subdivisions are nothing that a local person would use. Looking at the full API response, we can see: [jso] JSON{ "place_id": 258770727, "licence": "Data (c) OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright", "name": "Royal Botanic Gardens, Kew", "display_name": "Royal Botanic Gardens, Kew, Elizabeth Cottages, Kew, London Borough of Richmond upon Thames, London, Greater London, England, TW9 3NJ, United Kingdom", "address": { "leisure": "Royal Botanic Gardens, Kew", "road": "Elizabeth Cottages", "suburb": "Kew", "city_district": "London Borough of Richmond upon Thames", "ISO3166-2-lvl8": "GB-RIC", "city": "London", "state_district": "Greater London", "state": "England", "ISO3166-2-lvl4": "GB-ENG", "postcode": "TW9 3NJ", "country": "United Kingdom", "country_code": "gb" } } Aha! Perhaps I can build a better address using just those components! Except... Not every country has states. And not all states are used when giving addresses. Not every location is in a city. Some places have villages, prefectures, municipalities, and hamlets. New York, New York is a valid address, but Berlin, Berlin is not! There's an address formatter by OpenCage which is pretty sensible about stripping off irrelevant details. But, to go back to my first point, not every map location on OpenBenches is a street address and - even if it is on a street - it probably shouldn't have a house number. Well, there's kind of a solution to that! Most mapping provider have a POI function - we can find nearby things of interest and use them as a location. Here's a bench in Cook County, Illinois, USA. The POI address is: [jso] JSON{ ... "name": "Central Park", "coarse_location": "Des Plaines, IL, USA", ... } I assume there's only one Central Park in Des Plaines. Do people know that "Il" is Illinois? Would "Cook County" be useful? On the subject of localisation, not everywhere speaks English. Do I want to display addresses like "Yuan Bao noZi noXiang , Guang Dao , Ri Ben "? How about "Yuan Bao noZi noXiang , Hiroshima, Japan"? We're an international site, but most benches are in Anglophone countries. Of course, just because something is physically near a POI, that doesn't mean it is logically close to it. Consider a bench situated at the edge of this park A map, with a marker situated just across a river. The nearest POI is "Gay's Creamery" - across the river. Is that what you'd expect? Is there any way to easily say "if a point is inside an amenity* then use that as the address? I don't want the users of our site to have to select from a list of POIs or addresses, this should be as automated as possible. The Plan For each bench: 1. Use StadiaMaps to get the nearest POI. 2. Get the data in English. 3. Concatenate the name and coarse location. 4. Save the "address". 5. Wait for complaints? Thoughts? --------------------------------------------------------------------- Share this post on... * Mastodon * Facebook * LinkedIn * BlueSky * Threads * Reddit * HackerNews * Lobsters * WhatsApp * Telegram 7 thoughts on "Reverse Geocoding is Hard" 1. 2025-04-25 12:42 [64b70c86] [mastodon] NAB :marmite: said on mastodon.me.uk: @Edent If you can do the geolocation in realtime when I'm uploading a picture, show the results and ask "Is this location good enough?" with a Yes/No/Edit option, that would work, wouldn't it? Reply | Reply to original comment on mastodon.me.uk 2. 2025-04-25 13:21 [37df032a] [mastodon] Terence Eden said on mastodon.social: @NAB I could. But I'm wary of making people do too much hard work. And I don't want people to be able to accidentally or maliciously change the address. Perhaps a drop down is the answer? Reply | Reply to original comment on mastodon.social 3. 2025-04-25 13:31 [a51b0e3c] [crispsandw] Matt Round said on crispsandwi.ch: @Edent Hmm, wonder if you could compare nearest POI with bench address, only use POI if it has enough levels of address detail in common Reply | Reply to original comment on crispsandwi.ch 4. 2025-04-25 18:38 [ad25c12a] [our-qcodes] Merton says: I need to digest this. I'd be happy to let you use qCodes (remember me) [free of charge]. As you know I am not very technical so I'll have to study what you have done to see if qCodes can help you. Something like: OBN-XXXX. I'll post here when i have something. Just got the european patent, finally. Reply 5. 2025-04-26 11:19 [ad25c12a] Merton says: Further comment. I saw a great little clip. UK government wanted to encourage peple to walk more. So they wanted to build more walking paths. The guy in the clip, a real true marketing guru said: "You don't need more walking paths, you need more benches for people to take a break." Very clever idea. Reply 6. 2025-04-27 16:13 [18241c35] [news] news.ycombinator.com said on news.ycombinator.com: Reverse Geocoding Is Hard | Hacker News Reply | Reply to original comment on news.ycombinator.com 7. 2025-04-28 04:16 [94182dfe] [irrelevant] Rob says: Maybe get a distance to the POI from route planning software/ service. This should allow you to filter out close-but-irrelevant results, like that other-side-of-the-river one. Reply 8. [svg] More comments on Mastodon. What are your reckons? Cancel reply All comments are moderated and may not be published immediately. Your email address will not be published. [ ] [ ] [ ] [ ] [ ] [ ] [ ] Comment: [ ] See allowed HTML elements:

 
Your Name (required): [ ] Your Email (required): [ ] Your Website (optional): [ ] [Post Comment] To respond on your own website, write a post which contains a link to this post - then enter the URl of your page here. Learn more about WebMentions. [ ] [Ping me!] Search Search for: [ ] [Search] [?] Explore The Archives * 2025 + January 17 posts February 20 posts March 23 posts April 20 posts May June July August September October November December * 2024 + January 31 posts February 29 posts March 31 posts April 30 posts May 31 posts June 30 posts July 19 posts August 18 posts September 18 posts October 29 posts November 31 posts December 30 posts * 2023 + January 31 posts February 28 posts March 31 posts April 30 posts May 31 posts June 30 posts July 31 posts August 31 posts September 30 posts October 31 posts November 30 posts December 31 posts * 2022 + January 30 posts February 23 posts March 15 posts April 19 posts May 19 posts June 19 posts July 19 posts August 18 posts September 12 posts October 8 posts November 30 posts December 31 posts * 2021 + January 31 posts February 28 posts March 31 posts April 30 posts May 31 posts June 30 posts July 31 posts August 31 posts September 30 posts October 31 posts November 30 posts December 31 posts * 2020 + January 31 posts February 29 posts March 31 posts April 30 posts May 31 posts June 30 posts July 31 posts August 31 posts September 30 posts October 31 posts November 30 posts December 31 posts * 2019 + January 31 posts February 12 posts March 17 posts April 12 posts May 12 posts June 10 posts July 7 posts August 5 posts September 6 posts October 14 posts November 30 posts December 17 posts * 2018 + January 8 posts February 4 posts March 6 posts April 14 posts May 5 posts June 6 posts July 6 posts August 13 posts September 14 posts October 8 posts November 30 posts December 4 posts * 2017 + January 12 posts February 9 posts March 8 posts April 4 posts May 10 posts June 5 posts July 5 posts August 6 posts September 3 posts October 4 posts November 30 posts December * 2016 + January 10 posts February 10 posts March 11 posts April 9 posts May 8 posts June 9 posts July 6 posts August 9 posts September 4 posts October 2 posts November 30 posts December 14 posts * 2015 + January 8 posts February 11 posts March 10 posts April 4 posts May 9 posts June 3 posts July 7 posts August 9 posts September 10 posts October 2 posts November 30 posts December 4 posts * 2014 + January 13 posts February 13 posts March 15 posts April 14 posts May 8 posts June 7 posts July 9 posts August 5 posts September 5 posts October 1 post November 30 posts December 20 posts * 2013 + January 25 posts February 17 posts March 15 posts April 18 posts May 11 posts June 14 posts July 6 posts August 14 posts September 6 posts October 4 posts November 30 posts December 15 posts * 2012 + January 14 posts February 8 posts March 13 posts April 15 posts May 10 posts June 16 posts July 8 posts August 8 posts September 6 posts October 6 posts November 30 posts December 30 posts * 2011 + January 13 posts February 11 posts March 12 posts April 12 posts May 8 posts June 8 posts July 6 posts August 5 posts September 11 posts October 7 posts November 30 posts December 17 posts * 2010 + January 6 posts February 15 posts March 12 posts April 13 posts May 4 posts June 3 posts July 15 posts August 8 posts September 11 posts October 10 posts November 30 posts December 9 posts * 2009 + January 1 post February 5 posts March 3 posts April 7 posts May 12 posts June 8 posts July 10 posts August 10 posts September 12 posts October 22 posts November 31 posts December 15 posts * 2008 + January 2 posts February March 2 posts April 3 posts May 2 posts June July 1 post August 3 posts September 1 post October 3 posts November 2 posts December 1 post * 2007 + January February March April May June July August September October November 4 posts December 5 posts * 2006 + January February March April 1 post May June July August September October November 1 post December * 2005 + January February March 1 post April May June July August September 1 post October November December * 2004 + January February March April May 5 posts June 3 posts July 1 post August September October November December * 2003 + January February March 2 posts April May June July August September October November December * 2002 + January February 1 post March April 3 posts May June July August September October November December * 2001 + January February March April May June July 1 post August September October 1 post November December * 2000 + January February March 1 post April May June July August September October 1 post November 1 post December * 1999 + January February March April May June July August September 1 post October November December 1 post * 1998 + January February March April May 1 post June July August September October November December * 1997 + January 1 post February March April May June July August September October November December * 1995 + January February March 1 post April May 1 post June July August September October November December * 1993 + January February March April May June 1 post July August September October November December * 1987 + January February March April May June July August September October November December 1 post Subscribe by Email [ ] [ ] [Subscribe] * (c) Terence Eden * Contact Me * Subscribe * Citations * Support My Blog * Library * On This Day * Link Rot * Trending Posts * Random Post * About Me ISSN 2753-1570 MMXXV *