I'm trying to automate a rather annoying workflow in ArcGIS 10.4 with a Python script. My goal is to extract data from a polygon shapefile into another polygon shapefile which is arranged as a raster (see below). For that I use the tool intersect. Since I´m just interested in the green area in every square I than calculate the geometry of the intersection polygon. Finally I want the area column of the intersection polygon to be joined to the the "grey" polygon file and for that I would use spatial join. All together this works so far but I want just the area column to be joined and spatial join is joining all columns. I can manually delete these but since I'm having multiple files I don't want to do this.

With the help of Google I found fieldmapping but this is not really working and in my opinion its too complicated for what I want.

Is there a simpler approach maybe more Python-related?

It would be great if I could just join only the needed column in the first place.

Has anyone an idea on how I can solve my problem?


  • Use Make Feature Layer to "deactivate" the fields you dont want joined, then Spatial Join.
    – BERA
    Jan 7, 2019 at 11:59
  • Okay i tried it but is there a way of running the tool without specifing all the field info values? Because I have like 20 fields in my shapefile and now i would need to specify "fieldname new_fielname HIDDEN NONE" for 19 fields and the opposite for one field. For that I also had to know every field name, which I dont if the script runs automaticly. Isn`t there a way of just specifing the field I need and thats it?
    – Max2603
    Jan 8, 2019 at 12:08
  • Yes there is, you can set visibility to "HIDDEN" for all fields but one using arcpy. I would probably use a dictionary instead of Make Feature Layer to write data back from one fc to the other. I dont understand your question. The end results that you want is the grey Squares with only the intersecting green area joined to them, no other "green" attributes?
    – BERA
    Jan 8, 2019 at 12:16

1 Answer 1


Dictionaries are useful in situations when you need to transfer attributes between feature classes based on id.

From what I understand you dont want spatial join, instead use intersect to calculate the intersecting areas.

To add an attribute to the fishnet with the shape area of the intersecting green area and the fishnet cell you can try code below. The (join) key is the fishnet objectid.

import arcpy

fishnet = 'Fishnet_sample' #Change
greenareas = 'greenareas' #Change

tempinter = r'in_memory\inter5'
arcpy.Intersect_analysis(in_features=[fishnet,greenareas], out_feature_class=tempinter)
overlapdict = {k:v for k,v in arcpy.da.SearchCursor(tempinter,['FID_'+fishnet,'SHAPE@AREA'])} #Store fishnet id as key and intersection area as value in a dictionary

arcpy.AddField_management(in_table=fishnet, field_name='OverlapArea', field_type='DOUBLE')
with arcpy.da.UpdateCursor(fishnet,['OID@','OverlapArea']) as cursor:
    for row in cursor:
        if row[0] in overlapdict:
            row[1] = overlapdict[row[0]]
            row[1] = 0

enter image description here

  • Thank you, that works perfectly and also thanks for pointing me to dictionaries. I will consider these in my future projects. I have still one question, how do you bypass the 10 charackter limit in your field names? Are you using geodatabases?
    – Max2603
    Jan 8, 2019 at 23:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.