Select to view content in your preferred language

Spatial join and fieldmappings

2319
2
Jump to solution
12-12-2013 08:44 AM
BryceGardner1
Emerging Contributor
I have two feature classes that I am attempting to join. One is a point feature at the intersection of streets, the other is the streets line feature. I am using spatial join to create a new point feature that has the names of the streets as an attribute for the points. I know how to do this through the tool within ArcMap, but the code is a different matter. I have explored all the help through spatial join and fieldmappings, but it just doesn't make sense to me.

In the tool I create a new field, 'NAMES' and assign the streets names that intersect each point to that field, separating separate streets with a '&', using the windows in the tool. The tool makes simple work of this, however the code to make this happen is much more complex. Here is what I have so far.
#4. spatial join     fieldmappings = FieldMappings()     fieldmappings.removeAll()     fieldmappings.addFieldMap('NAMES')          SpatialJoin_analysis(dissolve_int, dissolve, spatial_join, 'JOIN_ONE_TO_ONE', '', fieldmappings, 'INTERSECT', '5 FEET')


I can't seem to figure out how to tell the program to assign the street names from the streets line feature to this new field and separate them with a '&'.

I know this is more advanced, but any help is appreciated.

Thanks,

Bryce
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Hi Bryce,

In ArcMap, run the spatial join tool with all parameters set and then open your Results window (Geoprocessing menu > Results).  Right-click on the completed tool > Copy as Python snippet.  You can then paste this into your IDE and see the correct syntax.

View solution in original post

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Bryce,

In ArcMap, run the spatial join tool with all parameters set and then open your Results window (Geoprocessing menu > Results).  Right-click on the completed tool > Copy as Python snippet.  You can then paste this into your IDE and see the correct syntax.
0 Kudos
BryceGardner1
Emerging Contributor
interesting. I will try that. Thanks!
0 Kudos