aix-weather-widget icon indicating copy to clipboard operation
aix-weather-widget copied to clipboard

ndfdXMLclient.php requires extra parameters

Open jasongyorog opened this issue 3 years ago • 3 comments

In AixNoaaWeatherData.java near line 478, the URL format is:

"https://www.weather.gov/forecasts/xml/sample_products/browser_interface/ndfdXMLclient.php"
+ "?lat=%.3f&lon=%.3f&product=time-series"

I tried requesting that URL with "curl" on the command line, and I got a 301 Moved Permanently.

I then tried the redirect URL, but I got XML with an embedded error message of "No data were found" until I specified the NDFD Element Names needed. As far as I can tell, the items needed by AIX are: temp, qpf, rh, and icons

Here is a list of all element names: https://graphical.weather.gov/xml/docs/elementInputNames.php

The widget is working again when I replace the above URL format with this one:

"https://graphical.weather.gov/xml/sample_products/browser_interface/ndfdXMLclient.php"
+  "?lat=%.3f&lon=%.3f&product=time-series&temp=temp&qpf=qpf&rh=rh&icons=icons"

jasongyorog avatar Sep 12 '20 03:09 jasongyorog

@jasongyorog Are you sure your new URL still works? I always get an error message but I have to use a VPN so I'm not sure....

Gitsaibot avatar Mar 16 '21 12:03 Gitsaibot

I actually didn't have the app installed on this phone, but I still had my modified source and I had a few moments, so I compiled it again and installed it. The new URL does seem to work, but it doesn't include precipitation data, so the parsing code is crashing. Looking at https://graphical.weather.gov/xml/docs/elementInputNames.php it still shows "qpf" as the correct parameter name. I removed the parameter name and the request was successful. Then, for no good reason, I added qpf=qpf at the end, and it now includes the precipitation data, so the widget is working again.

tl;dr -> Try rearranging the terms: "temp=temp&rh=rh&icons=icons&qpf=qpf" instead of "temp=temp&qpf=qpf&rh=rh&icons=icons"

... Oh, fine. Now, it seems to be working in the original order also. ¯_(ツ)_/¯

jasongyorog avatar Mar 16 '21 17:03 jasongyorog

Thank you for the research. After rearranging the order, the error is gone and the widget is working. I will add the changes into my fork,

Gitsaibot avatar Mar 17 '21 00:03 Gitsaibot