DurgNomis-drol/mytoyota

Reverse geocoding missing?

Closed this issue · 2 comments

Hi!

First of all thank you for this project! It's great!

Previously I was playing around with the old toyota API (I used https://github.com/calmjm/tojota as a client) and I saw that the basic trip information contained also the start and end address of the trip (in a human readable form f.ex. "Warsaw, Jerozolimiskie 156") .

But as far as I know your client can return only lat/lon.

Does this mean that Toyota stopped publishing addresses in their APIs? Is there any chances to get those addresses from Toyota, or do I have to look for some 3rd party libraries for this?

Thanks in advance!

I'm using the geopy library to convert the coordinates back to an easy to use address.
Some code I'm using for this is:

    def _lookup_address(self, coords: Tuple[str, ...]) -> str:     # pylint:disable=no-self-use
        """Determines the address of the given coordinates"""
        coord_str = ','.join(coordinate.strip().lower() for coordinate in coords[0:2])
        geolocator = Nominatim(user_agent=NOMINATIM_USER_AGENT)
        location = geolocator.reverse(coord_str)
        return (location.address if location else '')

For more details see: https://geopy.readthedocs.io/en/stable/#nominatim

A simple example is available at: https://spatial-dev.guru/2023/03/12/geocoding-and-reverse-geocoding-in-python-using-geopy/

So far, we have not found any direct information about address data for journeys in the endpoints of the current Toyota API.
So, like @joro75, you would have to rely on a 3rd party library to convert the GPS coordinates into addresses.