avwx-rest/avwx-api

METAR based on coordinates: Reporting vs Non-reporting Stations

vikaask opened this issue · 9 comments

METAR lookup based on coordinates pulls up non-reporting stations instead of prioritizing reporting stations.

Unable to use Reporting flag on search as well.

In the past, the following lookup

https://avwx.rest/api/metar/33.2,-111.7?onfail=cache&options=info&format=json

would provide a METAR for KCHD airport. In the last 2 days, the same lookup is now trying to pull up a METAR from a non-reporting airport

{
"error": "5AZ3 does not publish reports",
"timestamp": "2019-08-24T05:46:42.886751Z"
}

This basically renders the Coordinates functionality useless as it would require being at the exact coordinates of a reporting airport to receive METAR data. In essence, I get the closest airport, but not the closest reporting airport's weather info.

I have "reporting" and "airport" filters available for nearest station requests, so the logic is there. I'll need to change how parameters are validated to make this apply to report-based coordinate lookups.

Yeah, strange though how coordinate lookups as recent as last week worked as expected. Any recent changes? I assume it's something related to the airport database changing to include those stations?

Sorry I'm pretty new to this so I'm still wrapping my brain around this stuff

I found a bug that was the source of this error after adding the airport filter. As mentioned above, I've added the filters, but the default values should suffice. The onfail default has also been changed to cache, so your query params can be simplified to:

https://avwx.rest/api/metar/33.2,-111.7?options=info

Awesome! Thanks for the update and the quick fix!

Yours truly haha

As long as you live between
https://avwx.rest/api/station/CYLT
and
https://avwx.rest/api/station/NZSP
AVWX should work for you 😄