Select to view content in your preferred language

Select by location from a searchcursor?

464
2
Jump to solution
12-14-2022 07:45 AM
Labels (1)
Davec43
Occasional Contributor

I'm using a Search cursor to Print all the unique Serial Numbers from the attribute tool.

 

 

lyr = "Tracks"
serial = arcpy.da.SearchCursor(lyr, ['CL'])
unique_CLs = list(set([row[0] for row in serial]))
unique_CLs
print(unique_CLs)

 

 

It'll then print all unique serial numbers [1], [2], [3], [4], [5] etc.

How would I then script Select by attribute, create layer for each individual serial number?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

You would skip reinventing what already exists

Split By Attributes (Analysis)—ArcGIS Pro | Documentation

If you need to script, pass the parameters to the tool in your script


... sort of retired...

View solution in original post

2 Replies
DanPatterson
MVP Esteemed Contributor

You would skip reinventing what already exists

Split By Attributes (Analysis)—ArcGIS Pro | Documentation

If you need to script, pass the parameters to the tool in your script


... sort of retired...
Davec43
Occasional Contributor

Thanks!

0 Kudos