Linked Questions

3 votes
1 answer
1k views

ArcGIS 10.1 Python Script tool wont read string variable in SQL statement [duplicate]

I am working on a simple script tool that selects features from a .shp and creates a new output with only those features. Basically the user specifies(from a drop down list) the county and the ...
landocalrissian's user avatar
1 vote
1 answer
352 views

ExecuteError: ERROR 000358 - Using a variable within arcpy.Select_analysis() [duplicate]

I have looked at Including variable in where clause of arcpy.Select_analysis()? and while it is very similar to the question I'm asking I ran into the same issue after implementing its syntax. I feel ...
Chris Rice's user avatar
0 votes
0 answers
34 views

Using where clause for arcgis analysis in ArcPy? [duplicate]

I am trying to write a python code for select analysis. FIPS: column in feature nameofinputfeature whose values needs to be compared with OFIPS OFIPS: variable whose value is known each time the ...
pnkjmndhl's user avatar
  • 794
2 votes
0 answers
33 views

SelectLayerByAttribute over an iterable list - arcpy [duplicate]

I am trying to get arcpy to select features in a shapefile that appear in a list generated from a model output file in a variable called 'died'. The list looks like this: died ['acadian022', '...
Laura's user avatar
  • 21
16 votes
4 answers
21k views

Selecting features by attribute if in Python list?

I am trying to complete a select by attribute in Python but based on the query of whether an attribute is present in a list. Such a query at its simplest should be something like this: qry = " \"...
jsnider's user avatar
  • 475
3 votes
3 answers
5k views

SearchCursor() fails to read feature class?

I am very new to ArcPy and Python in general. I want write a script to read attribute table from a feature class and merge some data from a csv file into the table. Right now, I am just playing around ...
vandershraaf's user avatar
7 votes
1 answer
1k views

arcpy.SelectLayerByAttribute not working with an integer saved in a variable

I have a long code written and this is the last little bit I need and for whichever reason it does not work. This is the simple code. k=2 arcpy.SelectLayerByAttribute_management("poligon", "...
valsten's user avatar
  • 73
3 votes
2 answers
6k views

Formatting SQL queries for use in Arcpy?

I have to make an SQL query on a column having not adequat name "type_borne_id", I couldn't make SQL queries using arcpy.Select_analysis neither selectbyattribute, but when I use select_analysis ...
geogeek's user avatar
  • 4,566
3 votes
4 answers
5k views

Using GetParameterAsText and SelectLayerByAttribute in ArcPy

I have written a Python script tool wherein a user specifies a feature class (e.g., Landuse) containing different attributes (e.g., parcel size, landcover etc.), name of the attribute field from which ...
Brian's user avatar
  • 111
5 votes
2 answers
2k views

Problem with the where clause in ArcGIS when dealing with variables

I am writing a python script for ArcGIS. I have an input feature class which contains multiple pipelines which is saved as a variable InputPipeline. I would like to iterate through the pipelines and ...
Fezter's user avatar
  • 21.9k
0 votes
2 answers
3k views

How to pass expression to where clause in ArcPy? [duplicate]

I want to pass a user defined variable into a where clause Syntax SelectLayerByAttribute_management (in_layer_or_view, {selection_type}, {where_clause}) #user input MTRsel = arcpy.GetParameterAsText(...
alaskangraham's user avatar
2 votes
2 answers
683 views

Adding raw input to SQL string in ArcPy?

I have this py script for selecting one point. # Within selected features, select only those points of a chosen value arcpy.SelectLayerByAttribute_management("Stations", "NEW_SELECTION", ' "OID" = ...
Rod's user avatar
  • 65
1 vote
1 answer
2k views

ArcGIS 10.1 Converting a model tool to a script tool

I have recently created a model tool for a class project and my instructor would like it to be converted to a script tool for practice purposes. I have exported the script from my model and loaded it ...
landocalrissian's user avatar
3 votes
2 answers
2k views

Why do I lose data after converting from .xlsx to .shp?

I have a fairly large excel file that I need to convert to a shapefile, but everytime I export the data, I lose a bunch of it. The excel file has about 277,000 records, but the shapefile will only ...
linnea_n's user avatar
0 votes
1 answer
888 views

Points in Polygon Count: Error with arcpy.selectLayerByLocation_management

I'm working on generating some multivariate hexbins and am running into a problem with the initial step of counting the number of points (for the first variable) that are within each hex polygon. Here ...
scuerda's user avatar
  • 429
2 votes
1 answer
544 views

Select and zoom script for ArcPy?

I am attempting to make a simple select and zoom python script for my address points. Currently the script will complete successfully but will not select or zoom to the entered point. I am using two ...
jbaltierra's user avatar
-2 votes
2 answers
343 views

User prompt not working? [closed]

I created the following "trial.py": import arcpy #Get Name Name = str(arcpy.GetParameterAsText(0)) Then I created a toolbox using ArcCatalog and then added a script, pointed the above script file. ...
Manny's user avatar
  • 1
0 votes
1 answer
467 views

Writing Where Clause for text field in arcpy.SelectLayerByAttribute_management()?

I am having problems writing WhereClause for my program. I am using 10.3 arcmap. My layer comes form a file geodatabase. I have this code: mlayer = arcpy.mapping.ListLayers(mxd, "1415_LGA_SpatJ", ...
lida's user avatar
  • 147
2 votes
2 answers
293 views

How to create simple select script in ArcPy?

I am new to Python and want to create a script inside the ArcMap Python window. My current workspace is a series of rivers portrayed in the state of Ohio. I have a list of fish and the rivers (from my ...
Tim's user avatar
  • 21
0 votes
1 answer
483 views

Using input parameters to select layer by attribute

I am trying to create a Python-Toolbox with following Tool: inputFeature: A User has to load a Feature inputField: Then he has to to select a field from the Input Feature inputValue: At the end ...
Andreas's user avatar
  • 69
3 votes
1 answer
372 views

Cemetery Grave/Person Locator [closed]

I'm a mediocre to intermediate ArcGIS user. I have created several point shapefiles, one for each section of a national cemetery, roughly 200-600 points in each section in a grid. Attached to these ...
Steve Cary's user avatar
0 votes
1 answer
179 views

Error: Exception Raised on the "for row in rows" command line?

I am comparing fields in layers. I have the AADT layer and AADTAnno layer and I want it to search the fields FLAG and TFLAG. For Example: If there is a 29C9 in AADT layer in FLAG fields then there ...
Michelle Couden's user avatar
1 vote
1 answer
218 views

SelectLayerByAttribute_management searching with different datatypes

I am trying to use the SelectLayerByAttribute_management in a tool. The tool works like that: The User puts in the Feature which Layer should be selected by attribute -> "inputFeature". Then he ...
Andreas's user avatar
  • 69
2 votes
2 answers
217 views

Trying to use fieldmap to append external featureclass/shapefile to new featureclass using external table for mapping

I am trying to work out a way to populate a series of shape files into a new set of Datasets and feature classes. I have an external table of what the destination feature class field name should be ...
Dami Barnes's user avatar
0 votes
2 answers
77 views

What's wrong with my expression?

I'm trying to have a user input a county in my tool, and then use that string to select from a layer of counties. County = arcpy.GetParameterAsText(0) #Select county to clip arcpy....
Sam Kennard's user avatar