Show Polygons from Layer that are Isolated from Others

451
3
Jump to solution
05-26-2021 09:32 AM
MikeMacRae
Regular Contributor

Hello, I'm just getting into ArcGIS Online and was asked if I can provide a map that shows a polygon layer with a large amount of features and to highlight any polygons that are on their own, with no adjacent polygons. Where I am struggling is how to analyze the polygon layer for these isolated polygons. I'm pretty open to ideas, that being the use of python or arcade or even a built in tool or even some creative filtering/overlap analysis. I just haven't come up with anything that does this yet. Does anyone know, off the top of their head, a tool or algorithm that would run a routine through my polygon layer and find these isolated polygons?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
Peter_Klingman
Esri Regular Contributor

Hey @MikeMacRae, I think Arcade's Touches() function might be what you're looking for. It evaluates two features and determines if they are adjacent. If you want to symbolize on this field, you'll want to calculate a field using an Arcade expression and then symbolize on it. Otherwise, you can show the information in a pop-up. Touches() and other geometry functions are not included in the symbology profile for performance reasons (lots of expensive queries to the DB). Check out the example below on the Living Atlas US States layer. 

var name = $feature["STATE_NAME"]

var filteredLayer = Filter($layer, 'STATE_NAME <> @name')

var touchesOtherState = false;

for (var k in filteredLayer) {
    if (Touches(k, $feature)) {
        touchesOtherState = true;
        break;
    }
}

return touchesOtherState

 

If you're new to ArcGIS Online, this ArcGIS Learn Lesson provides a great introduction to Arcade. 

View solution in original post

3 Replies
Peter_Klingman
Esri Regular Contributor

Hey @MikeMacRae, I think Arcade's Touches() function might be what you're looking for. It evaluates two features and determines if they are adjacent. If you want to symbolize on this field, you'll want to calculate a field using an Arcade expression and then symbolize on it. Otherwise, you can show the information in a pop-up. Touches() and other geometry functions are not included in the symbology profile for performance reasons (lots of expensive queries to the DB). Check out the example below on the Living Atlas US States layer. 

var name = $feature["STATE_NAME"]

var filteredLayer = Filter($layer, 'STATE_NAME <> @name')

var touchesOtherState = false;

for (var k in filteredLayer) {
    if (Touches(k, $feature)) {
        touchesOtherState = true;
        break;
    }
}

return touchesOtherState

 

If you're new to ArcGIS Online, this ArcGIS Learn Lesson provides a great introduction to Arcade. 

MikeMacRae
Regular Contributor

Hey Peter. That's great. It works quite well with my data (albeit the popups take a bit of time to populate due to the size of my data).

You mentioned that geometry functions are not included in the profile for symbology which I have noticed. Is that the same for filters? (not the arcade filter, but the layer filter function) The new field doesn't appear in the list of field options to filter on. I've been searching through the help docs, but I can't find any mention on the use of custom fields in the filter.

0 Kudos
Peter_Klingman
Esri Regular Contributor

Hi @MikeMacRae, glad it worked! The use of expression fields in Filters is not currently supported, though it does look like there is a workaround posted on this thread. 

0 Kudos