I have two features in my map. A polygon feature and a point feature. I would like to join the polygon feature to the point feature using a common field. All the points are contained within the polygons. I have about 2000 points and 100's of polygons. I have tried using the Arcade expression below to calculate the join field in my point features to populate it with the unique identifier of the polygon:
var intersectLayer =Within(FeatureSetByName($datastore, "Polygon"),Geometry($feature))
var address = ""
var cnt = 0
for (var f in intersectLayer){
if (cnt == 0){
address = f.oaddr2
}
else {address = "No Address Found"}
}
return address
I am still very inexperienced with coding, so I apologize if my question is not entirely clear.
Hi Adam,
Are you trying to add attributes to a pop-up based on an intersection? If you are, have you seen the following document:
Thank you for this. This is useful!
Hi Adam Majzoub ,
There are a couple of things wrong with the expression. First of all you cannot provide a FeatureSet to the Within function. It requires geometries. If you only want to have a single address, you don't need to loop through the results. See the example below:
var intersectLayer = Intersects($feature, FeatureSetByName($datastore, "Polygon"));
var address = ""
var cnt = Count(intersectLayer);
if (cnt == 0) {
address = "No Address Found";
} else {
address = First(intersectLayer).oaddr2;
}
return address;