Automatically include current weather conditions for new features

07-13-2022 04:51 PM
New Contributor II

Someone at the showcase today asked about having Field Maps automatically include the current weather conditions for newly created features. Here's what I came up with.

Add the service Current Weather and Wind Station Data to your map.

Add a text field to your layer to store the weather conditions.

Using Field Maps web, create a calculated expression for the field and use this Arcade expression:


var searchArea = Buffer($feature, 25, 'miles')
var stations = Contains(searchArea, FeatureSetByName($map, 'Stations'))

var closest = null
var minDistance = Infinity

for (var next in stations) {
  var nextDistance = Distance($feature, next)

  if (nextDistance < minDistance) {
      closest = next
      minDistance = nextDistance

if (IsEmpty(closest)) {
    return null

return Text(closest['TEMP'], '#') + 'º F, ' + closest['SKY_CONDTN'] + ', Wind: ' + closest['WIND_SPEED'] + 'km/h'


There are a number of other attributes with interesting information so feel free to customize as you see fit.


3 Replies
New Contributor III

This is awesome Jeff! Do you know whether this would need to be modified to populate a field in a related table (insepction table) connected to the feature class?

We'd be adding a new related record (eg daily inspection) and not a new feature in this use case.

New Contributor II

Hi Alex,  

Were you able to find any information about your question on the related table?  I am looking for the exact same thing!  Thank you, 


0 Kudos
New Contributor III

Hi Darin,

Unfortunately, I have not yet had a chance to test out Jeff's solution on related tables. This was a 'nice to have' improvement and has been backlogged for the time being. If you are able to get this going, I'd love to know more!


0 Kudos