Select to view content in your preferred language

Getting Survey123 to auto-populate fields with weather parameters

840
4
Jump to solution
05-08-2023 08:22 AM
JoseBarrios1
Occasional Contributor III

Hello Community,

I'm working on a survey that requires to collect several weather parameters (Temp, wind speed/direction, cloud cover, rain and tide) and I was wondering if anyone has done anything like that using the NOAA National Weather Service (NWS) API. (api.weather.gov). There is a sample on connect using the openweather api that works great, however the parameters that is pulling are not accurate for the Caribbean. Any help or suggestions will be greatly appreciated!

Thanks,

JB

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

@JoseBarrios1 I think that your approach to present a list of known stations is great. It will simplify the survey greatly. Since you are working in a well-known area, you may even want to create a polygon layer so you can take the location from the user and get the ID from the polygon layer.

I noticed you wanted tide info but I did not find it myself. I see that you can navigate the NOAA website and find it so I hope you can get it working soon.  There is a lot of info from NOAA. I think people in the Survey123 community will appreciate knowing about the research your are doing. 

View solution in original post

4 Replies
IsmaelChivite
Esri Notable Contributor

Hi @JoseBarrios1 

I tweaked the OpenWeather sample to make it work against the NOAA service. The XLSForm and associated JS file are attached.  I hope this helps you get started. From my initial tests, it does not seem like the NOAA service gives you anything for the Caribbean. It looks as if the service only works for locations within the US.

JoseBarrios1
Occasional Contributor III

Saludos Ismael

Thanks you so much for taking time from your busy schedule to answer my question!. It work great, with the limitation that  the the API attributes does not have the  tide information and it is probably using a regional sensor to provide a local parameter.  I found a NOAA site that provide direct links to their weather stations but I'm not sure how to target those specific areas. Looking at http request, it seems that is using the station ID to pull the local weather parameter. Here the info provided by the closest station to the research area: https://tidesandcurrents.noaa.gov/stationhome.html?id=9759110#obs.  and the link for their web services are: https://tidesandcurrents.noaa.gov/gis-data-portal/ 

and the stations id: https://opendap.co-ops.nos.noaa.gov/stations/index.jsp

There are several stations around the research area (see attached pic) , I was wondering if I should change the workflow to pull a list a known station ID's and then use that ID to pull the weather parameters for that station so I can get accurate local weather parameters. Thanks once again for your providing your expertise and support! I know that many folks are also looking on how to accomplish this and I will share the final form template  in the  Connect community for the benefit of others! Thanks once again for your support! It is amazing what we can do with Survey123, awesome product!

Cheers,

JB

noaa1.png

 noaa2.png

 

0 Kudos
ZachBodenner
MVP Regular Contributor

Hey Ismael,

I'm trying to adapt your proof of concept to my own data and survey but I'm running into a snag that's confusing me. So my survey relied on a geoshape for the location question, which means I can't use your form directly. Instead, I gathered the names, lat's and lon's of the cities in my area, populated them in a csv stored in the media folder of the survey, and the users will manually slect the city they're in to populate the lat and lon fields, and then hopefully the rest of the script will populate the answers to the weather questions. So I added the fields to my feature class verbatim, copy-pasted the questions to the survey, added the function.js to the scripts folder, and then made the adjustments I mentioned above to populate the lat lons. Well, the pulldata form the csv appears to be working, as the lat and lon fields populate correctly when a city is selected, but the rest of the weather questions do not work.

I've also just created a new survey using the form you supplied and confirmed that works, so it doesn't seem like it's an issue with my environment. Is there anything about the function.js that would get tripped up by populating the lat and lon fields from a csv pulldata as opposed to using the geopoint?

0 Kudos
IsmaelChivite
Esri Notable Contributor

@JoseBarrios1 I think that your approach to present a list of known stations is great. It will simplify the survey greatly. Since you are working in a well-known area, you may even want to create a polygon layer so you can take the location from the user and get the ID from the polygon layer.

I noticed you wanted tide info but I did not find it myself. I see that you can navigate the NOAA website and find it so I hope you can get it working soon.  There is a lot of info from NOAA. I think people in the Survey123 community will appreciate knowing about the research your are doing.