Join Attributes From Polygon (Crime Analysis and Safety)


Joins attributes from input polygon features to input point features.


  • The tool transfers attributes from Input Polygon Features to the Target Point Features when a point feature is completely within or contained by a polygon feature.

  • By default, no attributes of the Input Polygon Features are appended to attributes of the Target Point Features. You can define which attributes will be added to the Target Point Features by specifying them in the Join Fields parameter.

  • When a feature in Target Point Features is contained by multiple features in Input Polygon Features, the point will get the attribute from the polygon with the largest Object ID value.


JoinAttributesFromPolygon(target_features, in_features, fields)
ParameterExplanationData Type

The point features to be updated with attributes from the in_features.

Feature Layer

The input polygon features.

Feature Layer

The fields from the Input Polygon Features that will be appended to the Target Point Features.


Derived Output

NameExplanationData Type

The updated point features.

Feature Layer

Code sample

JoinAttributesFromPolygon example 1 (Python window)

The following Python window script demonstrates how to use the JoinAttributesFromPolygon function in immediate mode.

import arcpy
arcpy.env.workspace = r"C:\data\city_pd.gdb""Arrests", "Precincts")
JoinAttributesFromPolygon example 2 (stand-alone script)

The following Python script demonstrates how to use the JoinAttributesFromPolygon function in a stand-alone script.

# Name:
# Description:  Adding police precinct id and name to arrests, then printing the number of arrests by precinct.

# import system modules 
import arcpy

# Set environment settings
arcpy.env.workspace = r"C:\data\city_pd.gdb"

# Set local variables
target_features = "Arrests"
in_features = "Precincts"
join_fields = ['districtid', 'name'] # Police Precinct ID and Name

# Execute JoinAttributesFromPolygon, in_features, join_fields)

#Print count of arrest by precinct
count_dict = {}
with arcpy.da.SearchCursor(target_features, 'name') as cursor:
    for row in cursor:
            count_dict[row[0]] += 1
            count_dict[row[0]] = 1

for precinct, count in count_dict.items():
    print("Name: " + precinct + " Arrests: " + str(count))


Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics