I am working on a project linking ideas in Geology and Ecology.

I currently have a map showing the geology of an area (polygon layer), with a points layer on top indicating the locations of data collection.

I have added an empty column to the attributes table for the points layer (geology_where_captured) and would like to know if there's a way - using arcpy - to fill in this column with the name or id of the geology that each data point is sitting within?

I have looked into the SummarizeWithin function but when I try to use this (I am using ArcMap 10.7.1 on my home computer) I get an error saying the object has no attribute?

I'm pretty new to Python.

I wrote this small bit of code following advice from https://pro.arcgis.com/en/pro-app/tool-reference/geoanalytics-desktop/summarize-within.htm



import arcpy
arcpy.env.workspace = 'C:\Users\User\Documents\University\4th Year Project\Data\mydata_arcgisOnline/XYLEMUR_DATA_AMBATOVY2.dbf'
summarizedLayer = "XYLEMUR_DATA_AMBATOVY2"
summaryPolys = "Geology"
arcpy.SummarizeWithin_analysis(summarizedLayer, summaryPolys, 'geology_where_captured')

Runtime error Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'SummarizeWithin_analysis'

No joy! (I'm new to this)


I think this classic point-in-polygon overlay operation is best handled using the Intersect_analysis tool wich:

Computes a geometric intersection of the input features.

If you input a feature class or shapefile of points, and another with polygons, then the output is any points falling within a polygon have the ID (and optionally attributes) of that polygon added to then end of its attribute table.

If you are using ArcMap rather than ArcGIS Pro then the answer is basically the same - see Merging Attributes of points into polygon using ArcMap?

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.