Tag Info

New answers tagged

0

You're using gridcode as text in a string, instead of a variable. Try: arcpy.SelectLayerByAttribute_management("LC_test","NEW_SELECTION", '"' gridcode + '" < 17 or "' + gridcode + '" = 21') The exact syntax you're after depends on data sources and field types. See the ArcGIS SQL reference for query expressions used in ArcGIS help.


1

I would dissolve the tracts by city and then use that with the Split tool in the Analysis toolbox to separate out the tracks.


3

You can use Select (Analysis) to perform this operation. This method has the added benefit of preserving your attributes. There are two main steps: Use a generator to list all of the unique city codes Loop through unique cities codes and add the code to the Select SQL expression import arcpy, os # Define the output workspace outws = r'C:\temp\out' # ...


1

If this is a one time job then, I will suggest you to use split by attributes tool from here. http://www.umesc.usgs.gov/management/dss/split_by_attribute_tool.html If you want to build your own tool using arcpy then here is my suggestion. Find all the unique values of the cities Select the main layer based on these unique values of cities and export it ...


1

You can use model builder to iterate through the features and export each as a separate feature class. In model builder if you right click on the open space you can select iterators and also the model only tool parse path. Open Parse path and select name for the drop down menu. Connect everything as i Have in the graphic below, use variable substitution to ...


1

There is a model builder equivalent in QGIS Tutorial While editing the builder save regularly, it isn't the most stable tool in the world =)


1

I'll try to do a little better job of explaining. This line is not necessary: arcpy.SelectLayerByAttribute_management("temp", "NEW_SELECTION", "FID" = count) Because you can instead just use the SearchCursor to loop through every feature in the temp layer, and use each feature's geometry object in the SelectByLocation. The geom variable is getting the ...


1

To try and debug this I would run the test below: import arcpy fc = "C:/Users/xkuai2/Downloads/temp/temp.shp" cursor = arcpy.SearchCursor(fc) for row in cursor: count = 0 Vol = row.getValue("Volume") print Vol This will mean your testing cycles are quicker than when doing the additional Geoprocessing. Your syntax up to that point looks OK to ...



Top 50 recent answers are included