en.osm.town is one of the many independent Mastodon servers you can use to participate in the fediverse.
An independent, community of OpenStreetMap people on the Fediverse/Mastodon. Funding graciously provided by the OpenStreetMap Foundation.

Server stats:

269
active users

OpenCage 👉🌍

Let's close out the week with a geo thread. This time rather than

Today's topic is one that doesn't get as much respect as it should.
Ask most people about geocoding, they automatically think forward geocoding - turning text (an address or placename) into coordinates.

Today though we'll cover the opposite: reverse geocoding

1/n

2/ Reverse geocoding is turning coordinates (latitude, longitude) into location info.

So 52.3877830, 9.7334394 becomes "Philipsbornstraße 2, 30165 Hanover, Germany" as you can see on our demo page.

opencagedata.com/demo

Those are the coordinates of OpenCage HQ, BTW

So far, so simple, right?

3/ The first question people usually ask is "why would I ever need that?"

Well, the main reason is tracking devices (GPS, etc) capture locations very precisely as coordinates.

But there is one big problem - coordinates make no sense to humans 🤔🤔🤔 ...

4/ Humans think in terms of countries, cities, neighbourhoods, addresses, etc. NOT coordinates.

Here's a basic example: a rental car company might want to know if their car left the country.

Reverse geocoding converts vehicle coords into country.

We work with many vehicle 🚗🚐🛻🚚 🚌 tracking companies

opencagedata.com/solutions/veh

5/ Reverse geocoding may seems simple, but there are lots of things to consider.

First up, different parts of world are structured very differently, with different admin hierarchies and ways to show addresses.

We format the address as expected locally.

BTW - the templates we use to do it are open sourced: github.com/OpenCageData/addres Pull requests gladly received!

6/ Of course most of the world has no hierarchy as all, it's water. We handle that as well.

See our thread on geocoding the oceans: en.osm.town/@opencage/11020778

7/ One small reverse geocoding pet peeve - people often send our geocoding API ultra precise coordinates. Like nanometer level.

There is no real need for more than 6 places past the decimal, see:

en.wikipedia.org/wiki/Decimal_

8/ Next issue - privacy 🕵️🕵️‍♂️🕵️‍♀️

Geocoding super precisely is technically cool, but can at times be a real privacy issue.

For example a website might want to show a user's neighbourhood, not their specific home address.

Here's our guide to geocoding "coarsely"

opencagedata.com/guides/how-to

opencagedata.comHow to use reverse geocoding and still preserve privacy How to preserve privacy when using geocoding by only showing an imprecise location a guide from OpenCage

9/ But by far the hardest part about reverse geocoding is that the world changes all day, every day.

There is continual new construction, demolition, address changes, changes of all kinds.

alone has 5+ MILLION edits per day (keep up the good work everyone!)

10/ If you want to play around with the ideas from this thread, we have a tutorial on writing your own reverse geocoder

opencagedata.com/guides/how-to

or of course you can just try out our API

11/ You'll find the tutorial and much more in our reverse geocoding guide:
opencagedata.com/reverse-geoco

Please share with anyone who might find it interesting. 🙏
Have a good weekend, and happy geocoding! 🙌

Final toot - if you enjoyed this thread (or if you hate and want an immediate fix of ) you can find the full list of our threads over on our blog:

blog.opencagedata.com/geothrea

enjoy!

@opencage what are your sources for the 'as expected locally'?

because for the example in Italy I honestly disagree this is the expected format...😕

@opencage as you can see from this example search on the Italian white pages (phone book) there's usually no comma between the street name and the house number, and the province code is usually written between (round) brackets:

paginebianche.it/persone?qs=bo)

so for ex:
Via Garibaldi 123, Torino (TO)

in some cases there's no house number so it's 'snc' "senza numero civico"

so for ex: Strada Cantonale snc, Rozzano (MI)

PagineBiancheBono a Roma - PagineBiancheBono a Roma. Su PagineBianche trovi informazioni, indirizzi e numeri di telefono di aziende e privati della tua città.

@sverx happy to hear case. Please submit an issue on the GitHub repo 🙏

@opencage Regarding reverse geocoding with OpenStreetMap, there are some other complications one should be aware of. Like polygons and interpolations. I'd recommend my own FOSDEM talk, "Reverse Geocoding Is Not Easy":

youtube.com/watch?v=sjE6xy0BBg