DenisCarriere / geocoder

:earth_asia: Python Geocoder
http://geocoder.readthedocs.org
MIT License
1.63k stars 287 forks source link

can't seem to get elevation from google #462

Open dotysan opened 1 year ago

dotysan commented 1 year ago

Using the example straight out of the documentation.

$ geocode '45.15, -75.14' --provider google --method elevation null

dotysan commented 1 year ago

So there appears to be a new API for this.

curl "https://maps.googleapis.com/maps/api/elevation/json?locations=45.15,-75.14&key=$GOOGLE_API_KEY"

{
   "error_message" : "This API key is not authorized to use this service or API.",
   "results" : [],
   "status" : "REQUEST_DENIED"
}

And after enabling the Maps Elevation API and adding it to my key: curl "https://maps.googleapis.com/maps/api/elevation/json?locations=45.15,-75.14&key=$GOOGLE_API_KEY"

{
   "results" : 
   [
      {
         "elevation" : 70.44151306152344,
         "location" : 
         {
            "lat" : 45.15,
            "lng" : -75.14
         },
         "resolution" : 38.17580795288086
      }
   ],
   "status" : "OK"
}
dotysan commented 1 year ago

Further poking around reveals that method='elevation' isn't passing the API key onto the params dict.

dotysan commented 1 year ago

Duplicate of #376. I guess this project is dead.