imagine I have one target polygon (A) and several underlying polygons (B1, B2, ...). Is there a way to concatenate attribute values of underlaying B polygons to target polygon A?
I was trying to create a script with Spatial join and rule (field maps), however, I was strugglling with two things:
1. it did not work :), but I believe that I could solve that one
2. there is no suitable match option for my case, please check this site.
I would like to match B polygons where A polygon is overlapping them. The default option INTERSECT however matches also in the case where two polygons touch by edges or when they have only one point in common. Well, I understand the coding part behind it, but from a practical point of view, this is bad. For example, you have a polygon of vegetation growing on multiple parcels. For every vegetation area, you want the string/list of parcel numbers. When I define my vegetation area exactly around several parcels (respecting their edges) I would get neighbor parcel numbers in my list too. 😕
Is there any workaround? The only thing that came to my mind is creating new vegetation areas with a very small negative buffer to avoid matching of edges.
Thank you very much for any tips on how to solve this.
p.s. Here is my code (not functional)
KN_Feature = "PARCELY_KN_JOIN"
areaVysledek = "area_Vysledek"
zapojporostFeature = "zapojporost"
fms1 = arcpy.FieldMappings()
keepers = ["cislo","KATUZE_KOD","TEXT_KM","DRUH_POZEMKU"] # etc.
# Remove all output fields you don't want.
for field in fms1.fields:
if field.name not in keepers:
parcela_index = fms1.findFieldMapIndex("TEXT_KM")
fieldmap = fms1.getFieldMap(parcela_index)
field = fieldmap.outputField
field.name = "parcelaCislo"
field.aliasName = "parcela č."
fieldmap.outputField = field
fieldmap.mergeRule = "Join"
fieldmap.joinDelimiter = ", "
drupoz_index = fms1.findFieldMapIndex("DRUH_POZEMKU")
fieldmap1 = fms1.getFieldMap(drupoz_index)
field1 = fieldmap1.outputField
field1.name = "druhPozemku1"
field1.aliasName = "druh pozemku"
fieldmap1.outputField = field1
fieldmap1.mergeRule = "Join"
fieldmap1.joinDelimiter = ", "
# SpatailJoin pro plochy
arcpy.analysis.SpatialJoin(zapojporostFeature, "PARCELY_KN_JOIN", areaVysledek, 'JOIN_ONE_TO_ONE',"KEEP_ALL",fms1)
Solved! Go to Solution.
Your case is very interesting. Spatial Join tool's Join Features parameter takes only one feature class or layer as input. But you have multiple join feature classes.
You can give Jayanta Poddar's suggestion a try - it's a good suggestion.
You wrote you couldn't find any suitable match option - which relationship (except for the given ones) you are looking for?
Send an email to me at email@example.com
thank you for your answer. Jayanta's suggestion works as expected.
Spatial Join however is still having this INTERSECT option (default) which is different from Intersect (Analysis). I would expect it to be the same thing (i.e. return the same results).