Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Spatial join and fieldmappings

$
0
0
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.
Code:

#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

Viewing all articles
Browse latest Browse all 2485

Trending Articles