In ArcGIS Pro, I have a map with a polygon layer, called Cont_Freg_CAOP2022, which has a text-type attribute, 6 characters long, called DICOFRE (e.g. "010121").
In addition to this, I have another layer of points, called Arvores_PGIFU, which has a text attribute, also called Dicofre.
I want to intersect the point layer with the polygon layer, return the value of the DICOFRE attribute of the intersected polygon and write this value in the point Dicofre field.
To do this, I created the expression:
// Determines the DICOFRE attribute of the Cont_Freg_CAOP2022 layer
// identified by the intersection with a point in the Arvores_PGIFU layer
var Dicofre_Fregs = FeatureSetByName($map, 'Cont_Freg_CAOP2022', ['DICOFRE'])
// Intersect the current location with the polygons and return the dicofre
var Dicofre_Int = First(Intersects($feature, Dicofre_Fregs))
// If the current location intersects a polygon, return DICOFRE, otherwise return null.
if (!IsEmpty(Dicofre_Int)) {
return Dicofre_Int['DICOFRE']
} else {
return null
}
When checking the expression I get the error message:
Invalid expression.
Error on line 4.
Object not found $map
Any help?
