Privacy first! In many cases you might not want to show a precisely geocoded location. As a very basic example: imagine you're building an app that lets people share photos. You might want to show the neighbourhood and city a user of the app is in, but probably not the precise house address.
Due to privacy concerns you might not want to show a precisely geocoded location
If you send coordinates (for example the location of the user's phone, or
the coordinates you extracted from the photo) to the
OpenCage geocoding API,
by default we will reverse geocode those coordinates to as precise
a location as possible, for example a building address.
We then format that address correctly for that country and put the result
value of the API result.
So what can you do if you don't want to show that exact address?
Creating your own privacy respecting formatted string
The solution is you need to create your own location string to display from the hierarchy pieces we return in the
52.536507, 13.426880we return a
Jablonskistraße 29, 10405 Berlin, Germanybut with the logic below you would instead show
Winsviertel, Prenzlauer Berg, Berlin, Germanywhich is correct but not precise.
2,500 geocoding API requests per day.
No credit card required.