Tagged Questions
2
votes
1answer
64 views
Select by attribute expression invalid in python
I'm not sure how my expression is failing. Any ideas?
inPoints = "points.shp"
i = 0
arcpy.MakeFeatureLayer_management(inPoints, "pts")
arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", ...
2
votes
3answers
83 views
Creating a where clause from user input/Python list
I am trying to perform a query based on values in a Python list. The where clause will then be used in an Update Cursor, so that the rows NOT equal to the values in the list will be deleted.
This is ...
1
vote
4answers
91 views
Get vector features inside a specific extent
The problem:
I have a very large vector layer with many features and a much smaller raster layer in a defined region. I want to get only those vector features which are within the raster layers ...
0
votes
1answer
81 views
Where Clause problems when all parts are user input variables
I have written some generic user ipnut code for a toolbox script (ArcGIS 10.0) but because everything is a variable I don't know how to write the SQL whereclause.
Please can someone help and suggest ...
0
votes
0answers
35 views
SQL statement in MakeTableView_management
EDIT: Finally found a way around this..
expression = "[Route] = '" + route + "' AND [Trip] = " + str(trip)
arcpy.MakeTableView_management(solutionTable, "solutionView", expression )
I tried str() ...
6
votes
3answers
125 views
Are there any open source Python modules compatible with arcpy that will allow complex SQL queries?
I am trying to handle string (non-geometry) duplicates in a large attribute table of a shapefile without having to convert to gdb and back or connect to a postgres db. I need to be able to use a count ...
2
votes
1answer
260 views
How do I select * rows of multiple columns in one query using Select by Attributes within ArcMap?
I am trying to convert a psql query string into arcpy formatting for an UpdateCursor where expression parameter:
'''SELECT ...
4
votes
1answer
137 views
Is it possible to run an arcpy execute SQL method without connecting to any database or server?
I want to simply process a layer by writing a tool script in a toolbox without having to connect any database, so I think I may have to set up a workspace environment in ArcMap, but I'm not sure if I ...
3
votes
1answer
103 views
raster2pgsql: Strange error when creating a table
Hi GIS Stackexchange people,
When I try to load a asc file into my psql setup, I get a strange error message.
I have created the sql input file via
raster2pgsql -s 4236 -I -C -M gis_data.asc -F ...
3
votes
1answer
395 views
Python script for constructing a WHERE clause from user input
I'm trying to construct a where clause from user input that will eventually be passed through as a SQL statement in the select tool or the select by attributes tool. I've started a script thats been ...
4
votes
3answers
879 views
Select features by attribute if in Python list
I believe this will amount to largely a sql syntax question. Essentially, 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.
...
2
votes
0answers
180 views
Creating a model to run a complex query
I'm just a rookie when it comes to creating models in ArcGIS. I have two shapefiles from which I need to calculate an AVG and a MAX erosion rate for individual properties.
The two shapefiles are:
...
4
votes
3answers
265 views
arcgis10 filter dataset
Using ArcGIS 10 SP-4
I have a large dataset of sites that needs to be filtered down to a usable size. There is an attribute for the site_ID and another one for the site_type. There are duplicate ...
1
vote
1answer
120 views
Python SQL connection causes crash in ArcMap
I have the following code which I have striped down to just included the part that is causing a crash in ArcMap.
import pymssql
# Connect to the Research db using Windows Integrated Authentication.
...
1
vote
1answer
321 views
Passing parameters to PostGIS SQL queries in Python: weird behaviour
The following code always goes to the except section and I do not understand why..Any help would be much appreciated.
l = None
c = conn.cursor()
try:
s = "SELECT ST_NPoints(ST_GeomFromText(%s))"
...