NREL / developer.nrel.gov

An issue tracker for NREL's APIs available at https://developer.nrel.gov
43 stars 39 forks source link

Alternative Fuel Station API not returning results based on lat & lon #209

Closed sfirke closed 3 years ago

sfirke commented 3 years ago

Hello,

I'm trying to retrieve EV charging stations in the Ann Arbor, MI area. I'm making an API query with that latitude and longitude, but am getting unrelated results, e.g., chargers in California. My query is:

https://developer.nrel.gov/api/alt-fuel-stations/v1.csv?fuel_type=ELEC&latitude=42.277419&longitude=-83.749477&radius=10&limit=200&api_key=<myAPIkey>

Can you advise on how to retrieve just the stations within 10 miles of that lat/lon ? I read the API documentation, sorry if I'm missing something obvious. Thanks!

kandersolar commented 3 years ago

Hi @sfirke I'm not familiar with the alt-fuel-stations api, but maybe you just need to edit the url to include /nearest, i.e. instead of /api/alt-fuel-stations/v1, use /api/alt-fuel-stations/v1/nearest? See the different endpoints here:

https://developer.nrel.gov/docs/transportation/alt-fuel-stations-v1/

sfirke commented 3 years ago

That was it! Thank you @kanderso-nrel. For anyone else who finds this in the future, I used this URL:

https://developer.nrel.gov/api/alt-fuel-stations/v1/nearest.csv?fuel_type=ELEC&latitude=42.277419&longitude=-83.749477&radius=15&limit=all&api_key=DEMO_KEY