I am trying to label streets on a map. I want only streets that are within a the polygon layer to display.
Is there a way to do this with arcade or is another way better?
Another way would be to clip your streets layer by your polygon, set this street symbol to no color, and then label this street layer rather than the one that extends beyond the polygon.
@jcarlson Yes I can modify the polygon layer. If I cannot find anything else I will try that. Thanks!
Oh, shoot. I forgot that using FeatureSetBy... functions is not available in the labeling Arcade profile. My mistake.
Everything else I can find will eliminate labels within a polygon, but not the inverse. Is the polygon layer something you can modify? If you turned it into a giant "donut", with the current shape being the "hole", you could use the Label Weight Ranking settings to exclude labels within that area.
@jcarlson
I am getting this error.
Try FeatureSetByName, maybe? That would look like this:
var aoi = FeatureSetByName($map, 'polygon_layername'); if(Intersects($feature, aoi)){ return $feature.label_field }
@jcarlson Thank you for the quick reply.
I am not using portal so I cannot use var portal. Is there a way to identify another layer in pro arcade.
var portal = Portal('https://www.arcgis.com'); var aoi = FeatureSetByPortalItem(portal, 'polygon_itemid', 0); if(Intersects($feature, aoi)){ return $feature.label_field }
That might grab features that are along the edge or barely touch it. You could apply a negative buffer on the polygon, or change Intersects to Within, if you get too many "edge" features labelled.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.