3.0 unable to spatial join one to many

953
4
Jump to solution
07-08-2022 02:20 PM
Labels (3)
renatavg
New Contributor

Hi all! I just updated to ArcGIS Pro for Desktop 3.0.0. I'm trying to do a spatial join between two point files, where I want to join all the points from file B that fall within a 200ft radius of the points in file A. I've chosen the same options that I would have from 2.3 but it's only returning a join of the closest point from file B (if it's within 200ft). Am I doing something incorrectly or is this a strange bug? Thanks!

renatavg_0-1657314759026.png

(showing a point from file A in green that should be linked to four points from file B in pink)

renatavg_1-1657314887386.png

(attribute table showing only one joined object)

Add Spatial Join
=====================
Parameters

Target Features 2022\sw_2022_wgs
Join Features 2022\LitterBasket_DSNY_June2022_wgs
Output Feature Class 2022\sw_2022_wgs
Join Operation JOIN_ONE_TO_MANY
Keep All Target Features KEEP_ALL
Field Map BASKETID "BASKETID" true true false 4 Long 0 0,First,#,LitterBasket_DSNY_June2022_wgs,BASKETID,-1,-1;BASKETTYPE "BASKETTYPE" true true false 8000 Text 0 0,First,#,LitterBasket_DSNY_June2022_wgs,BASKETTYPE,0,8000;
Match Option WITHIN_A_DISTANCE
Search Radius 200 Feet
Distance Field Name
=====================
Messages

Start Time: Friday, July 8, 2022 4:59:26 PM
Temporary data will be created in XXXX
Succeeded at Friday, July 8, 2022 5:00:39 PM (Elapsed Time: 1 minutes 13 seconds)

(syntax run)

0 Kudos
1 Solution

Accepted Solutions
VincentLaunstorfer
Occasional Contributor III

Hi,

If this 'one-to-many' join is not solved, you can use the Spatial Join (Analysis) geoprocessing tool:

https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/spatial-join.htm#GUID-F9111853-D7D3...

which do perform 'one-to-many' spatial join (ensure your features class and tables are in a geodatabase as standalone shapefiles and tables do not usually perform 'one-to-many' joins).

The Add Spatial Join (Data Management) do not permit 'one-to-many' joins.

Hope this helps.

View solution in original post

4 Replies
SamSzotkowski
New Contributor III

When you do a one to many spatial join, your join count will always be 0 or 1, since a record will be created for each join feature that has the specified relationship to a given target feature.

I'm guessing you either mixed up what should be a target vs join feature, or the behavior of one to one vs one to many.  I'd look carefully at the documentation if that's the case, but in your example you should do:

Target feature = file A / green points

Join feature = file B / red points

And let's say the object id of your green point is 1 and the ids of the red points are 1,2,3,4.  You should expect your output to have 4 features stacked on top of the original green point, with TARGET_FID all being 1, and JOIN_FIDs being 1, 2, 3, and 4.

If you have indeed done everything correctly and it's still not working as you'd expect, it could be a coordinate system thing.  Your measure tool is giving geodesic distance, but your relationship in the tool is Within a Distance.  You should use Within a Distance Geodesic so it's apples to apples.

0 Kudos
renatavg
New Contributor

Thanks for your response! I’m pretty sure the join is in the right direction and that it hasn’t worked, since I’ve used the same inputs as I had in 2.3 which worked fine. The attribute table is sorted on the ID column so I know no columns have been added for the other points from table B, and the attribute table is showing the same number of rows after the join anyway. 

The coordinate systems are definitely the same for these data files (I’ve checked and double checked, even re-added the data again). You may have something with the geodesic vs regular distance—can you say more on the difference between the two? 

0 Kudos
SamSzotkowski
New Contributor III

Looking closer at this a few things are confusing to me.  Is the output feature class the same as the target feature class?  That would certainly cause some confusion, since you may have overwritten your original dataset.

In your first paragraph here, you say no columns have been added.  Well at least a couple have, your join count and target/join fids.  But anything beyond that is controlled by the field map, so check that you filled it out correctly.

Also, regardless of what settings you used before, make sure you understand what it's doing now.  (And there's no harm in messing with the settings and trying different combos)  You should have green points as target and red points as join features.  You can see if the parameters changed between versions in the documentation, there's a drop down at the top where you can select older versions, but I think it's much more likely you made a mistake with your inputs, as I have countless times.

It's good that the coordinate system of both layers match, but what I was getting at is that your spatial join currently is computing the planar distance between the two layers' features in their coordinate systems, but you showed you used the measure tool on the map.  That tool doesn't care about the layers' coordinate systems, it only cares about the map's.  Which may very well be the same as your layers, idk.

But you have to be careful because suppose you're measuring the planar distance between two points in Greenland, using a web Mercator projection.  Your measurement will be horribly distorted.  Pretty much everywhere you should use a geodesic measurement unless your coordinate system is already highly accurate, like a US State Plane projection.  You can Google "planar vs geodesic distance" and you'll find a much clearer answer about that.  But as a general rule of thumb, you can think of geodesic as always the correct distance, and planar as sometimes the correct distance.

0 Kudos
VincentLaunstorfer
Occasional Contributor III

Hi,

If this 'one-to-many' join is not solved, you can use the Spatial Join (Analysis) geoprocessing tool:

https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/spatial-join.htm#GUID-F9111853-D7D3...

which do perform 'one-to-many' spatial join (ensure your features class and tables are in a geodatabase as standalone shapefiles and tables do not usually perform 'one-to-many' joins).

The Add Spatial Join (Data Management) do not permit 'one-to-many' joins.

Hope this helps.