Select to view content in your preferred language

One-to-Many Spatial Join - Join Count Per Group

271
3
08-08-2025 08:50 AM
Status: Open
Labels (1)
Bud
by
Esteemed Contributor

Edited.

I have a municipality FC and a riding FC. The spatial relationship of the data is one-to-many: one municipality intersects many ridings.

I want to do a one-to-many spatial join (a row for each intersecting riding), but I want a column in the output that indicates the Join_Count_Per_Group; I want each row to indicate how many ridings there are per municipality. All within a single geoprocessing operation. Currently, with one-to-many spatial joins, the Join_Count field is set to 1 (or zero?) for every row.

3 Comments
AdrianWelsh

I am not sure that can be accomplished in one single geoprocessing operation. I am guessing a one to many would result in giving you more features (municipalities) than what you started with, thus it makes sense that each one is 1 or 0. You would likely need to perform a Summary Statistics process to make a table counting all the points within your municipalities, then tabularly join that table back to your spatially joined feature class.

https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/summary-statistics.htm 

Unless I am not fully understanding the issue here.

MargaretCrawford

Hello @Bud, I am not sure what output  you would like but to get the number of "ridings there are per municipality" you could try using a 1-to-1 join operation instead.

here I made 2 feature classes: municipal boundaries and schools. Then in the Spatial Join tool, I used the municipal boundaries as the target feature and schools as the join feature, and set the join operation to one-to-one

MargaretCrawford_0-1754673641668.png

The output's join_count field includes a count of all the schools per municipality. 

MargaretCrawford_1-1754673815808.png

-Margaret

 

 

Bud
by

@MargaretCrawford 

Here's a screenshot of what I'm looking for. I manually created the Join_Count_Per_Group field after the fact to show what I want. 

Bud_0-1754677891601.png

Use Case: I want a list of municipalities and the ridings that touch the municipalities. I want one row per riding/municipality combination, hence the one to many join. And I want to only include rows where there is more than one riding per municipality, by creating a definition query:  Join_Count_Per_Group > 1. I want to do this using a single geoprocessing tool.