Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radius query param not working #303

Open
albertRCell opened this issue Jan 31, 2023 · 3 comments
Open

Radius query param not working #303

albertRCell opened this issue Jan 31, 2023 · 3 comments

Comments

@albertRCell
Copy link

Hello,

I'm trying the nearest api with different values for radius param, however looks like I always get the same result regardless of the value passed, here's an example of the request.

https://developer.nrel.gov/api/alt-fuel-stations/v1/nearest.json?api_key=MY_KEY&fuel_type=ELEC&latitude=38.623038&longitude=-121.448351&radius=25

Thanks in advance.

@ScottHutchinson
Copy link

Too bad nobody is responding to these issues more promptly.

I don't see a radius request parameter listed at the documentation. Either that parameter is undocumented, or the API should respond with an 'unknown parameter' error.

In fact, I don't see latitude or longitude in the documentation either. But what you are attempting seems very useful, so it would be a good enhancement if it's not yet supported.

@GUI
Copy link
Member

GUI commented Mar 20, 2023

@albertRCell: Sorry this slipped past us. The radius parameter defines the maximum radius of results returned. However, you must also pay attention to the limit parameter, since by default we only return the 20 closest results (results are ordered by how close they are to the input lat/lon). So in the case of this latitude/longitude, there are currently 717 separate station locations within 25 miles. So with the default limit of 20 applied, the first 20 results are all within 2 miles, so that's why you're likely not seeing a difference in the response if you're trying to increase the radius. Try passing in the limit=all parameter, or use the offset parameter (with a smaller limit) to paginate through all of the available results. Hope that helps clarify things, but let us know if think you're still seeing any issues.

@ScottHutchinson: The radius, latitude, and longitude parameters are all valid for the Nearest Stations API (you were linking to the "All Stations API" which is focused on bulk downloads and not geospatial capabilities, so that's why it's not an option on that endpoint).

@albertRCell
Copy link
Author

@GUI Thank you very much for the explanation, limit parameter is doing the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants