How to get Address from Latitude & Longitude in Django GeoIP?

后端 未结 4 1205
遇见更好的自我
遇见更好的自我 2021-02-06 08:39

I cannot see anything in their API to do this: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoip/#geoip-api

Or should I just use Google API for Reverse Geocodi

4条回答
  •  无人及你
    2021-02-06 09:09

    Use geopy, it can handle multiple geocoders including googlev3.

    from geopy.geocoders import GoogleV3
    geolocator = GoogleV3()
    location = geolocator.reverse("52.509669, 13.376294")
    print(location.address)
    >>> Potsdamer Platz, Mitte, Berlin, 10117, Deutschland, European Union
    

    install with pip:

    pip install geopy
    

    infos found on: https://github.com/geopy/geopy

提交回复
热议问题