Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

0
votes
2answers
96 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 = ...
0
votes
3answers
78 views

How to define an output parameter in Python script exported from ModelBuilder

I have a modelbuilder parent model with two nested models in it that ouputs a dwg file. I exported the parent model to a python script which is shown below. In modelbuilder, the output dwg file is a ...
0
votes
1answer
79 views

how can I add all feature classes of the same name to an mxd in python

I have a bunch of folders which all have (almost) identical folder structures and file geodatabases of identical structures which in this folder structure. I need to add all of the same type of ...
1
vote
1answer
111 views

Problem creating point shapefiles programmatically using python in QGIS 2.2

I am trying to create a point shapefile in the memory buffer (for a temporary label) and then zoom to the extents on this buffer. The working (in version 2.1) test code for this is: def ...
1
vote
1answer
39 views

If Then Modelbuilder, Project error

I have a model where I want to check the projection. If it is GCS_WGS_1984, I want it to go one path, and if it isn't, I want it to go another path. I created a "Check Coordinates of Input" script ...
0
votes
1answer
52 views

How to get the pixels from a geotiff file in gdal python for a given bbox?

I have a GeoTIFF file in WSG 84 Projection reference (it's a GeoTIFF of SRTM). I can use python & gdal to read the whole lot of data into an array (with ReadAsArray()), but I want to only have a ...
0
votes
4answers
43 views

Why QgsMapCanvas only appear after lost focus?

I created the simple frame .UI file, compiled with pyuic4, and tried the ShapeViewer.py to load the shapefile "world_borders.shp". However, the map doesn't display at the first time. I have to click ...
2
votes
1answer
52 views

Hydrology tool dataset in ArcGIS 10.1 for calculating slope?

I am quite new to the hydrology toolset in ArcGIS and thought it may be useful for extracting slope data from a raster; I was wondering if anyone had experience trying to extract slope data upslope ...
0
votes
1answer
41 views

name 'AddressLocator' is not defined, Python created Address Locator

When I run this tool, I get the error 'name 'locator_AddressLocator_n_' is not defined'. My guess is that this is an issue with the path where the locator is trying to save to? So, I am assuming I ...
0
votes
0answers
14 views

std::bad alloc when writing simple script in QGIS

I'm running QGIS 1.8 on Scientific Linux and I'm attempting to write a script (obviously this will be built upon to do something useful) which simply writes to a file. ##raster=raster value=5 ...
0
votes
2answers
88 views

How to use Field Value from arcpy.GetParameterAsText()?

I want to to is have a user select a feature class, which then populates the fields that can be selected (this works), create a new field in that feature (works), and then populate the new field with ...
3
votes
1answer
42 views

Understanding arcpy log files in the scratchWorkspace

When I run a tool through arcpy, a file simply called 'log' with no extension is created in the scratchWorkspace. This is quite different to the history log files which are XML and I cannot find any ...
1
vote
2answers
60 views

Run a model from python problem

I am using arcGIS 10.0 SP5 I have the following code : import arcpy arcpy.ImportToolbox(r"C:\Documents and Settings\Derek\FRAME\FORTEST.tbx", "Derek") arcpy.TEST_Derek() The model is names TEST ...
0
votes
2answers
68 views

Add value to a field Python

I was wondering if anyone can help me with some Python? I have a featuers Class with the columns KOMMUNE and GKR and some other columns.. Both columns are string. In the column KOMMUNE I have the ...
0
votes
1answer
79 views

Create Ms-Access type queries in ArcMap [closed]

We have a dataset with a personal GDB (mdb) with several feature classes and an mxd tied to those features to create layers based on definition queries… Currently to QAQC our data we use MsAccess ...
1
vote
1answer
60 views

Precondition in Modelbuilder - use in next process

In modelbuilder I am trying to create a tool which will check the coordinate system of the input shapefile. If it is GCS_WGS_1984, then nothing happens. If it is not, then it will reproject it to ...
1
vote
2answers
37 views

Is there a tool that allows the same functionality of extend/trim feature that was available in 9.3?

In ArcGIS 9.3 there was a tool called Extend/Trim Features that allowed you to select multiple segments and extend or trim them to a feature. In 10.1 that seems to have been moved to the Production ...
0
votes
2answers
91 views

Why am I getting 'Error 000732 Raster does not exist'?

I am trying to apply symbology to a raster layer via kernel density analysis. When I run the Python script below in ArcMap, I am get the error message below. I have searched and tried the common ...
-1
votes
1answer
38 views

plypython set-up

I am trying to set up plypython on the following system: Windows 8.1 PostgreSQL 9.2 64-bit PostGIS 2.0 Python 2.7.05 I have added plpython2.dll to \PostgreSQL\9.2\lib When I run: CREATE ...
2
votes
1answer
132 views

Multiprocessing issues with ArcPy

I am using ArcGIS 'watershed' routine in a script which makes use of multiprocessing. This works fine, but during execution I get the message: Unable to remove directory. Possible causes: 1- Not ...
6
votes
3answers
239 views

Count number of attributes for unique field values

Running ArcGIS 10.1, I have two feature classes in a geodatabase. One is a point FC for polling stations, the other is a polygon FC for states. The polling station FC contains over 1000 points and ...
1
vote
1answer
82 views

How to plot street addresses and streets using Python/GIS?

I asked this on stackoverflow but did not get a really clear answer. I am not really familiar with GIS systems in python. I am looking for a library to do the following: Lets say I have a pandas data ...
2
votes
2answers
66 views

Is there a way to do a python batch script for Analyze and Compress on SDE Databases?

I created and modified python scripts based off of ERSI's example (http://resources.arcgis.com/en/help/main/10.2/index.html#//003n000000v7000000), however, what would be great is to be able to batch ...
0
votes
0answers
39 views

How to get the signal when the color changes in pyQGIS?

I would like to have the signal when the color of a vector layer is changed by the user. In the doc, there is a signal that seems to fit ...
0
votes
0answers
45 views

Creation of drainage ditch in ArcGIS - Line with a certain slope

I have a digital terrain model and a list of problematic points, in which water accumulates. It's not important how I obtained these points (by observing or some algorythm). I would like to use these ...
3
votes
1answer
42 views

Any way to perform zonal statistics on column other than value or do reclass faster?

I have to perform ArcGIS zonal statistics on a raster, but the column I am interested in is not the 'value' column. Now, I can reclass the raster so that the column of interest becomes the 'value' ...
2
votes
4answers
266 views

How to turn all lines into one direction?

How can I turn all features of my polyline (postgis and/or shapefile) into one direction - it doesn't matter what direction. I know how to switch the direction of lines but I have no idea how to ...
2
votes
1answer
57 views

AddJoin failing in Python ArcGIS

My AddJoin operation is failing: arcpy.CopyRows_management(lup_file,out_dir+'lup') try: # Perform copy rows on merged csv file print 'start' aa = arcpy.Raster(SEIMF) ...
0
votes
0answers
70 views

GEOS assertion failed

The following script fails, if I import the 'rasterstats' library. import rasterstats import ogr geom1 = ogr.CreateGeometryFromWkt('POLYGON ((415924.806155724043492 ...
3
votes
1answer
51 views

Is there a tool to track edits that were made?

Is there a tool/report that keeps track of what edits were made that I could run prior to or after reconciling my versions? This would help me to know if there are any changes I need to make to any ...
-1
votes
2answers
172 views

How to compare values from a column in attribute table with values in Dictionary{}?

I am just entering to the python world, hence the level of my question. Can anyone tell me what Python function should I use to compare values stored in one column in an attribute table with values ...
0
votes
0answers
40 views

Creating a line along an existing polyline from a point

I have a large data set of points, all of which lie on a river network and have x, y co-ordinates. I want to calculate the slope of the river channel at each point from the underlying DEM by taking ...
0
votes
0answers
29 views

How to add field to postgres layer with PyQgis?

I'm fetching a posgtres layer with PyQgis and then I'm trying to add field with this: lyr.startEditing() lyr.addAttribute(QgsField("class", QVariant.Int)) But It is not adding the field and also ...
2
votes
1answer
76 views

Plugin Tutorial issue: trying to work around changes in QGIS API

I'm currently following the tutorial to create my first python plugin for QGIS: http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html and have similar issues to this thread: QGIS 2.0 Plugin: ...
0
votes
0answers
21 views

UnicodeEncodeError when using arcpy.gp.TraceGeometricNetwork_management() [closed]

I am creating a python tool (run through ArcMap) which will eventually go through a feature class selected by a downstream trace and use the obtained values to do some function. I am trying to follow ...
0
votes
0answers
46 views

arcpy.SearchCursor strangely throwing IO Error

I've been trying to use arcpy.SearchCursor on an xls file. Something I've done countless times before. I had a script running and then yesterday it started throwing: IOError: ...
3
votes
1answer
76 views

Python Postgres Multiprocessing speed increase

I'm trying to speed up my PostGIS queries using multiprocessing. My current setup is using python and psycopg2 such as below. Although this has given a speed increase, it still seems like there are ...
1
vote
2answers
76 views

How to get an indication of how points are spatially distributed?

Let's say I have a set of points and I want to get an indication of their spatial distribution. That is, if all points are at one location a possible return value would be 0, whereas if all points are ...
0
votes
1answer
61 views

ArcGIS arcpy reprojecting raster issue

I have a raster which I want to reproject from GCS_WGS_1984 to GCS_NorthAmerican_1983. I am using the following code: try: spatial_ref = ...
1
vote
0answers
42 views

Install PyQGIS in virtualenv

Is it possible to install PyQGIS in virtual environment? I want to use rendering capabilities in my own application which runs using virtualenv.
0
votes
1answer
60 views

problem with SelectLayerByAttribute management in script

hello my problem is that this tool works perfectly in IDLE or PyScripter programs, but if I use in the script in ArcGIS desktop this problem occurs: arcgisscripting.ExecuteError:ERROR 000582... why ...
0
votes
0answers
87 views

ArcGIS Python Field Calculation

Ok so i've got a problem with the field calculator in ArcGIS: I'm already pretty far with it since i got some help :P but it still doesnt work. What i've got: -A complete table of several states of ...
1
vote
1answer
27 views

How can I pan an ArcGIS map from an external application?

I have a web application with geocoded addresses. I would like to be able to click on an address within that application, and have ArcMap 10 respond by panning the map to the corresponding location. ...
2
votes
3answers
71 views

Best way to find points outside state boundary that are supposed to be within specific State

I have a nationwide featureclass called bakeries. In the bakeries FC, there is a field called "State" and the field is populated with state abbreviations(AL,NJ,CT,etc). I have another feature class ...
4
votes
0answers
61 views

How can I modify layer order with the QGIS python API

Typically, after a new_layer = addRasterLayer(...) that inserts new_layer before the active layer, I'd like to move it to the top of the table of contents. How to do it? I use an existing QGIS ...
0
votes
0answers
40 views

Spatialite not available from qgis python console

I have a problem using pyspatialite from within the qgis python console. When I run the following code in ipython from pyspatialite import dbapi2 as sqlite conn=sqlite.connect("MyDB.sqlite") ...
1
vote
0answers
74 views

Publishing esri geoprocessing service - upload custom python modules?

I have an esri geoprocessing service which causes problems when publishing to arcgis server. The python scripts behind the service are structured as a custom python module, in a folder with an ...
2
votes
1answer
92 views

How to do a separate Python installation with ArcGIS?

I see a lot of threads asking how you can have a separate Python installation (e.g. the Anaconda or Python XY distribution) and get it to work with arcpy, while not 'breaking' ArcGIS at the same time. ...
0
votes
0answers
34 views

How to get the color of a vector layer in pyQGIS?

I have see this topic (How to change the color of a vector layer in pyQGIS?) but I'm looking for get the color not to change. How I can resolve my problem ? Thanks
2
votes
1answer
107 views

How to draw polygons from the python console?

I've been visiting and revisiting the page on geometry handling in the PyQGIS Cookbook: https://www.qgis.org/en/docs/pyqgis_developer_cookbook/geometry.html but can't seem to figure out how to get the ...