Survey123: Using Pulldata to Access Open Weather/MSN Weather Parameters

1941
2
Jump to solution
01-11-2021 01:57 PM
dgray
by
New Contributor III

Hello,

 

I would like some help in getting Survey123 to populate attribute fields with weather parameters.  It looks like there used to be a document on how to do this, but it’s no longer available. 

 

https://community.esri.com/t5/arcgis-survey123-questions/using-pulldata-to-gather-live-weather-data/...

 

This site points to another link with some instructions:

https://community.esri.com/t5/arcgis-survey123-blog/extending-survey123-smart-forms-with-custom-js-f...

 

It looks like MSN Weather also has parameters:

https://docs.microsoft.com/en-gb/connectors/msnweather/

Open Weather has this information:

https://openweathermap.org/api/one-call-api#how

However, I’m unfamiliar with Javascript, and don’t know how to apply this information to my specific problem.  I need a step-by-step breakdown of how to use a pulldata function to get parameters either from Open Weather or MSN Weather, showing a specific javascript code example that I can use as a model from which to copy.  The actual pulldata function is straightforward, but I need help mostly with the JS part.

0 Kudos
1 Solution

Accepted Solutions
dgray
by
New Contributor III

I have found a solution for this:

There is a sample Survey123 template in Survey123 Connect that provides the code:

  1. Open Survey123 Connect
  2. Select New Survey
  3. Select Samples
  4. In the search bar, type JavaScript
  5. Select Create Survey

The sample survey has a Working with a Third-Party API - Open Weather example.
Once the sample survey is created, you will have access to the xls form as well as the JavaScript files used to create the survey. You can reference the pulldown expression and the Javascript code when creating your survey. 

The sample code provides an API key, but you can sign up to OpenWeather and get your own key.  There's a lot of documentation on making API calls:

https://openweathermap.org/api

The one downside I discovered, however, is that using a free OpenWeather account you can get CURRENT weather parameters, and hourly forecast data, but unfortunately you cannot get a daily forecast summary (e.g. min and max temperature) without paying for an OpenWeather subscription.

View solution in original post

2 Replies
dgray
by
New Contributor III

I have found a solution for this:

There is a sample Survey123 template in Survey123 Connect that provides the code:

  1. Open Survey123 Connect
  2. Select New Survey
  3. Select Samples
  4. In the search bar, type JavaScript
  5. Select Create Survey

The sample survey has a Working with a Third-Party API - Open Weather example.
Once the sample survey is created, you will have access to the xls form as well as the JavaScript files used to create the survey. You can reference the pulldown expression and the Javascript code when creating your survey. 

The sample code provides an API key, but you can sign up to OpenWeather and get your own key.  There's a lot of documentation on making API calls:

https://openweathermap.org/api

The one downside I discovered, however, is that using a free OpenWeather account you can get CURRENT weather parameters, and hourly forecast data, but unfortunately you cannot get a daily forecast summary (e.g. min and max temperature) without paying for an OpenWeather subscription.

DanLissick
New Contributor II

Has anyone create a survey to pull historical weather data with the new One Call 30.0 API?

0 Kudos