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.