Hi, I am attempting to create an attribute expression through an address point layer that intersects a zoning layer. The zone layer has an attribute that is coded with different zones, i.e. "RR" for residential, "CG" for commercial. I'm using Intersect to find the polygon layer and retrieve the attribute but having an issue with re-writing the return result. I used the code below but am having an issue with the open brace { at the switch line in code below (line 10 in the image). Any help would be greatly appreciated!
// Variables for the layers
var point = $feature;
var polygons = FeatureSetByName($map, "COG Zoning");
// Initialize the output string
var result = "No intersection";
// Loop through polygons to check intersection
for (var poly in polygons) {
if (Intersects(point, poly)) {
// Customize this part to return specific text based on polygon attributes
switch (poly.Pro_Zoning) {
case "RR":
result = "Residential";
break;
case "CG":
result = "Commercial";
break;
// Add more cases as needed
default:
result = "Zoning data is not available";
}
}
}
// Return the result string
return result;