I have a set of polygons and I want to add a field with the name of the streets (from another feature class of streets) that are within each polygon. Using Select Features by Location, I select streets that are within the polygons, but I can't think of a way (using python) to automate the process of populating each polygon with the name of the street that falls within it. I don't have a matching field for either feature class to base a join on. Is this possible or is it something that would have to be done manually?

  • 1
    What software package are you working with? Dec 19 '12 at 17:24
  • arcmap ..........
    – Kevin
    Dec 19 '12 at 21:58
  • 1
    What are you wanting to see when "populating each polygon with the name of the street that falls within it"? I could show you how to add the streets in a polygon as a comma delimited list but I would imagine that could be a very long field if there are hundreds of streets in some polygons. Alternatives could be to use a spatial join to create a table listing for each street what polygon(s) it is in or to do an Intersect which can pull the polygon attributes onto the streets that pass through it.
    – PolyGeo
    Dec 19 '12 at 23:07

Try something to do with this, it is the idea, but it mostly untested, but i am sure it good and it's should work: This "your_streets" and "your_polygons" are your feature classe.


for street in cursor:


if arcpy.Exists(street_layer):
arcpy.SelectLayerByAttribute_management(street_layer, "NEW_SELECTION", "\"OBJECTID\" = "+str(ID_line))

if arcpy.Exists(polygons_layer):


for polygon in cursor_1:

The analysis that you want to do, might be a bit strange, as you may have lots of streets passing trough your polygons, and it might be complicated put all that in a single field, but I do not know your dataset, so it might be perfectly reasonable.

A quite easy way would be to use the following algorithm that you can process in a Python Script:

  • Use Spatial join using Polygons as "Target features" and street as "Join Features", set the merge rule for streets field name to join (use ", " as separator) and intersects in the "matching";
  • Make Feature Layer from your Polygons
  • Add Join between Polygons Layer and the output of the Spatial Join using the original FID
  • Add field Streets_Name (text 255)
  • Calculate Field Streets_Name from the joined table Join_Street_Name Field
  • Remove Join
  • Delete (Management) Spatial Join Output

Remember that if the join of the street names from any polygon is bigger than 155 character you will have problems...

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.