New answers tagged select-by-attribute
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 =)
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 ...
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 ...
Even if you could stomach writing 565 AND statements, that wouldn't give you what you wanted. What you're actually seeking to do is known as a table join. You want to select the records of one of your tables that have a match in the other table. Once you have your tables loaded in ArcGIS (and you will probably need to load your CSV to something indexed by ...
Use the QGIS Count Points in Polygon tool:
Assuming you have access to ArcGIS, you could do a spatial join as described on this page: http://support.esri.com/cn/knowledgebase/techarticles/detail/30779 Then just select polygons where the count field is larger than 1.
A safer way to do this would be: val = raw_input("Ask for something. ") query = """ "ATTRIBUTE_NAME" = '%s'"""%val arcpy.SelectLayerByAttribute_management("Sample", "NEW_SELECTION", query) In this case, using %s will convert the value you get to string. This way, if the user inputs an integer, the + operator won't fail to create the query. If you ...
You'll make life simpler in the future by using Add Field Delimiters. This will work for shapefiles, feature classes in a file geodatabase, personal geodatabase, etc. You might find that str.format() also makes building strings with quotation marks easier to read/write. val = raw_input("Ask user for something:\n") fc = "Sample" field = ...
I've not tried doing such in that particular circumstance, but normally when doing similar work in python, I would do something like the following: val = raw_input("Ask user for something.") selection = str(""" "ATTRIBUTENAME" = '""" + val + "'") arcpy.SelectLayerByAttribute_management("Sample", "NEW_SELECTION", selection) Also note, that, at least in ...
I have just had a similar problem and used this work around. Open the layer properties and select Definition query and use the expression below. KM NOT LIKE '%.%' This will remove all rows with a . in the field. As long as the kilometer points aren't whole numbers like 1.0 or 2.0 etc. this should work.
Top 50 recent answers are included