I'm using arcmap 10.1 and have one shp with many polygons with different typeID. I want to make a serie of maps showing each typeID on an individual map. Since I have many typeIDs I want to use arcpy. And here is the problem. I don't know which arcpy function to use to select only one typeID and remove all the others; and then repeat this step for all IDs.
SOLUTION: Here is my code after I fixed it. Now it works:)
mxd=arcpy.mapping.MapDocument("CURRENT")
def getValueList (inputTable, field):
values = set()
rows = arcpy.SearchCursor(inputTable)
for row in rows:
values.add(row.getValue(field))
return sorted(values)
list=getValueList('my_shp_file', 'typeID')
lyr=arcpy.mapping.Layer('my_shp_file')
where_clause='"typeID"='
for type in list:
lyr.definitionQuery=where_clause+str(type)
arcpy.mapping.ExportToJPEG(mxd, "C:\\my_location\\"+str(type)+".jpg")
Thanks for suggestions! Rok