spatial join for the same layer

421
3
05-05-2020 07:14 AM
mohamedradwan
New Contributor

how can we create spatial join without creating new layer?

0 Kudos
3 Replies
NobbirAhmed
Esri Regular Contributor

So, you have two layers/feature classes and you want to join fields from one of the layers to the other, right? Could you please elaborate your goal? I can guess but it's be better to gather as much details as possible. 

0 Kudos
DavidPike
MVP Frequent Contributor

Something like an arcpy.da.SearchCurosr to compare geometries then create a matching dictionary of some sort. Would it be worth the effort? whats the purpose?

0 Kudos
NobbirAhmed
Esri Regular Contributor

If you don't want to create a new layer (output), you'll have to transfer attributes (based on the chosen spatial relationship between two input feature classes) from Join Features to Target Features. But it's not always possible based on what parameter options you chose from all the other parameters.

Spatial Join is a very versatile tool with many options to spatially compare two feature classes or layers. 

You can use any of the eighteen spatial relationship via the options provided by 'Match Option' parameter, such as, Intersect, Within, Contains, Closest, Within a Distance and whether to keep all or only relevant related features, and so on. 

Each of the relationship could limit the search by providing a Search Distance within which the relationship is sought for. 

The Join Operation parameter's 'Join one to many' option will create an output containing more records than the records in the Target Features - this will be little troublesome if you want to join fields from Join Features parameter to Target Features.

Then there is the useful parameter called Field Mapping - (in Pro it's named Fields). You can add new fields and store values from multiple join or target features. You can have a totally new set of fields in the output - each of which can store values as set by the Field Map parameter.

One way I can think of using Spatial Join to update/add/remove fields in Target Features (your first input) to use a Script Tool or Python script to capture all the values form both inputs and all other parameter values as set and internally update the Target Features. 

Or, you can elaborately state what's the purpose or goal of your project/exercise.

You can also email me at nahmed@esri.com

0 Kudos