Select by Location - Largest Overlap

1213
8
Jump to solution
04-13-2021 03:51 PM
dgray
by
New Contributor III

Does anyone know if there is a Select by Location type tool that chooses polygons of Largest Overlap?  I know there's a script tool that performs this as a  Spatial Join at

https://hub.arcgis.com/datasets/e9cccd343bf84916bda1910c31e5eab2

but I want use the same processes as a selection, not a spatial join.  Does this exist, or would someone be able to use the code and modify it to perform a selection of largest overlap?

0 Kudos
1 Solution

Accepted Solutions
dgray
by
New Contributor III

Hi Dan,

Great news, Esri tech support found a solution to this problem!

First, run the Intersect tool between parcels and zoning, in order to divide the zoning polygons that extend beyond a given parcel's boundaries. The Shape_Area field will automatically be recalculated for the feature class output by the Intersect tool, but you can confirm the area is correct by creating a new field and using the Calculate Geometry tool. 

dgray_0-1620155932890.png

Next, set the Summarize Within tool to summarize the Shape_Area field of the output of the Intersect using the parameters in the image below:

dgray_1-1620155932917.png

Finally, export features from the output (right-click on output of Summarize Within tool in Contents > Data >Export Features) using the expression below (I arbitrarily selected 0.01 for the ratio of summarized zone area to parcel area to account for multipart parcels but this can be modified as desired.  The original test used 0.5 in the screen shot, but a lot of parcels will get omitted with such a large cutoff.)

dgray_2-1620155932936.png

This creates an almost perfect match between parcel and zoning.  This procedure can be used in many other situations where you are looking for a match of area of largest overlap.

View solution in original post

0 Kudos
8 Replies
DanPatterson
MVP Esteemed Contributor

Count Overlapping Features (Analysis)—ArcGIS Pro | Documentation

yields a planarized polygons output of the overlaps, but not as a selection by location operation.  It would have to further be queried for the largest area.


... sort of retired...
0 Kudos
dgray
by
New Contributor III

Hi Dan,

How could a query be done for the largest area using this method?  I have tried this with my dataset and unfortunately I can't get it to work.  I'm trying to select from among a parcel dataset with over 200,000 items those which most overlap with another dataset of zoning polygons (containing hundreds of items) whose shapes don't always match or coincide.  I've tried running Count Overlapping Features, which takes a long time to run, and also spit out the table with the original OID's.  The Count_FC of 2 is what I need.  No matter what joining method I use, I cannot then perform a selection on the parcels with the join--somewhere in the process, ArcGIS Pro freezes up just trying to do the work and it doesn't happen.  But even if I get it to work, this would be just picking any parcels that have any kind of intersection with the other layer, not necessarily the largest overlap.  

Select by Location "Have their center in" is the best closest approximation to what I'm looking for, but unfortunately when the parcel shape and the zoning shape are very different, the appropriate associated parcel will get missed. 

Parcels are black, and zoning is green in this example, where the parcels that are most appropriate to be selected don't have their centre in the zoning:

dgray_0-1618434192180.png

If I just use "Intersect", parcels intersecting the borders of the zoning polygon get chosen in addition as the appropriate parcels, which are not relevant at all and are unwanted.  

Trying to remove the unwanted polygons from the selection one by one is very time-consuming, imperfect, and inefficient.  I would love to know if there's a process to just get the parcels that are affected by the zoning polygons, no less, and no more, using geoprocessing.  

I've also tried using the Spatial Join - Largest Overlap tool, but I'm getting a runtime error and the script won't complete:

https://community.esri.com/t5/arcgis-pro-questions/spatial-join-largest-overlap-arcgis-pro/m-p/10470...

What can I do?

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

problem is more complex than originally envisioned. 

I suspect that working in steps and producing intermediate datasets might be the only way you can proceed, if you are getting runtime errors (which may be due to memory limitations).

A select by location (intersect) of your parcels with your zoning would be a first step.   Keep that result.  Is it much smaller than the original? Can you select by largest overlap from there?

If you can't reduce your candidate parcels to a manageable size, you might have to end up subdividing your area and finding a process that works in smaller batches

 


... sort of retired...
0 Kudos
dgray
by
New Contributor III

Ok, so I created an "Intersect" subset of parcels intersecting zoning and made a new feature class, which made the file size manageable (3700 features). 

I then used Count Overlapping Features with the table option, and selected a subset where Count_FC is 2.  I joined the table to the Overlapping Features output and made a new feature class. Then I joined this using Original OID to the OID of the Intersect subset.  Using joined features, this seemed to help reduce the amount of parcels selected and include funny-shaped polygons whose centres aren't in the zoning polygons.  But I still have the edge polygons to get rid of from my subset.

Selected parcels are in the pale green.

dgray_0-1618442770104.png

What do I do from here to eliminate them?  It still goes back to the original problem: I only wanted parcels who share the largest overlap with the zoning.

P.S. - I tried a subset of 2100 items to run the Largest Overlap tool, and this did not prevent the runtime error, so this error is something else most likely.

0 Kudos
DanPatterson
MVP Esteemed Contributor

skip the count overlaps now.

pick/select 2 polygons from each set that you know overlap... run Largest Overlap tool.  Does it work?

If not, then there is something wrong with the script 


... sort of retired...
0 Kudos
dgray
by
New Contributor III

Tried joining one parcel to one polygon, and I still get the runtime error.  I tried using two completely different datasets and it's still giving me the Invalid SQL message.  I think there's something wrong with the script.

0 Kudos
DanPatterson
MVP Esteemed Contributor

You will have to contact the authors...

It seems quite old

ArcGIS 10.1

ArcView (Basic) license or higher

and if you are running this in ArcGIS Pro (aka, Python 3.7), then there will be issues related to the script.

 


... sort of retired...
0 Kudos
dgray
by
New Contributor III

Hi Dan,

Great news, Esri tech support found a solution to this problem!

First, run the Intersect tool between parcels and zoning, in order to divide the zoning polygons that extend beyond a given parcel's boundaries. The Shape_Area field will automatically be recalculated for the feature class output by the Intersect tool, but you can confirm the area is correct by creating a new field and using the Calculate Geometry tool. 

dgray_0-1620155932890.png

Next, set the Summarize Within tool to summarize the Shape_Area field of the output of the Intersect using the parameters in the image below:

dgray_1-1620155932917.png

Finally, export features from the output (right-click on output of Summarize Within tool in Contents > Data >Export Features) using the expression below (I arbitrarily selected 0.01 for the ratio of summarized zone area to parcel area to account for multipart parcels but this can be modified as desired.  The original test used 0.5 in the screen shot, but a lot of parcels will get omitted with such a large cutoff.)

dgray_2-1620155932936.png

This creates an almost perfect match between parcel and zoning.  This procedure can be used in many other situations where you are looking for a match of area of largest overlap.

0 Kudos