I'm trying to write an Arcade expression that does the following. If a line is within the boundary of another poly layer, the line takes the name attribution from the boundary, but only if the line is of a certain type. So far we have this which does the first part.
var OLT = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries",["cab_id"], true) var intersectLayer = Intersects(OLT, Geometry($feature)) if (Count(intersectLayer) > 0) { var layer = First(intersectLayer); return layer.cab_id; } else { return null; }
However I'm struggling with the part that only pulls in cab_id if intersectsLayer is of a certain type. Any input on this is greatly appreciated.
Solved!去解决方案。
var OLT = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries",["cab_id"], true) var intersectLayer = Intersects(OLT, Geometry($feature)) if (Count(intersectLayer) > 0 && ($feature.cabletype == 'F1' || $feature.cabletype == 'F2')) { var layer = First(intersectLayer); return layer.cab_id; } else { return null; }
A certain type? can you elaborate?
Yes we have a type field that has different labels. And we only want this function to apply to lines of a specific type in the layer. Here's what I'm trying to do (Although incorrect so far...)
var OLT = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries",["cab_id"], true) var intersectLayer = Intersects(OLT, Geometry($feature)) if ((Count(intersectLayer) > 0) and ($feature.cabletype == 'F1' or 'F2')) { var layer = First(instersectLayer); return layer.cab_id; } else { return null; }
var OLT = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries",["cab_id"], true) var intersectLayer = Intersects(OLT, Geometry($feature)) if (Count(intersectLayer) > 0 && ($feature.cabletype == 'F1' || $feature.cabletype == 'F2')) { var layer = First(intersectLayer); return layer.cab_id; } else { return null; }
That works! The syntax example will also help a lot for future rules, so thanks so much!