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

learn more… | top users | synonyms

3
votes
2answers
123 views

Python code to compare two fields in different feature layers?

I have two shapefiles which encompass 3897 features each. Corresponding shapefiles (village and watershed that flows into it) have the same ID (ws_id in one, OBJECTID in the other). Many watersheds ...
0
votes
1answer
42 views

Cause of ExecuteError: ERROR 000539: Invalid field County Insets.OBJECTID Failed to execute (CalculateField)?

The following script joins two layers on a common id and attempts to use the OBJECTID in the joined table to update records for a field in the input table. In running it in "current" mode, it moves ...
0
votes
0answers
39 views

How to manage two map items in a QGIS composition with python?

I need to manage two different map items in the same map composition, with a stand alone python script. Each composer map has been referenced like this: composerMap1 = ...
2
votes
1answer
47 views

GDAL Python Not Working Correctly - Raster Calculations

I am sure this question has been asked and answered before. I am working with a x64 bit installation of OSGeo4W. I am trying to perform raster calculations using the gdal through the OSGeo4W shell, ...
2
votes
1answer
59 views

How to get into the Python API of QGIS?

After a few hours I am about to give up on finding a kind of documentation for the QGIS Python API that actually works/gives the correct information. It is obvious that there is no actual code ...
1
vote
1answer
29 views

QGIS raster calculator using abs() function

Is it possible to use the Abs() function in the raster calculator in QGIS? I've tried it, but it didn't work.
1
vote
0answers
32 views

QGIS processing framework SAGA NaturalNeighbor in external Python Script - No Output

I want to build a little script, which generates a NaturalNeighbor grid based on a point Shapefile. The script runs within my PyDev environment without any error messages, but no outputfile is ...
2
votes
1answer
49 views

arcpy with multiprocessing throws “UnpickleableError: Cannot pickle <type 'geoprocessing Layer object'> objects”

I'm attempting to speed up a process which is currently running synchronously, by using the python multiprocessing module. I'm having trouble sending a feature layer to a function which is called by ...
3
votes
1answer
50 views

Generate end points from a layer that contains multiple lines

I generate a layer file that has multiple parallel lines, that I want is to sequentially (from OBJECTID(1) to OBJECTID(Max)) create a point at each end point of the line segments and number these ...
1
vote
0answers
23 views

Setting up ArcPad applet (Python) that calls arcgisscripting?

I've been asked to support a legacy script that was "made" (read: found) by a former coworker. My python skills are pretty basic, so I went right to installing the applet like I would for a VBS ...
3
votes
2answers
107 views

How I can reverse numbers in a string without reversing any text? [closed]

I have a string, I need to reverse just the numbers in the string without the text: String: [321 test] The result will be: [123 test]
7
votes
1answer
87 views

Meaning of exclamation mark in Python parser of ArcGIS Field Calculator?

In the following line, I don't understand what those exclamation marks mean? And why put everything in quotation? I don't understand the purpose of the variable expression, please explain to me as I'm ...
1
vote
1answer
44 views

Populating Access (*.mdb) table with text from Text Elements to inventory MXDs using ArcPy/Python?

I am trying to write a piece of code to populate an Access mdb table with information from text elements in an mxd (text elements all have "names"). The purpose of this is to create a catalog of my ...
1
vote
2answers
95 views

Split a string column into 2 columns in python [closed]

I have a csv file and this is the structure of that file. It has only one column with number of strings. I want to split this one column into 2 columns at the character \. Can anyone please tell me ...
0
votes
1answer
40 views

Explicitly close a OGR result object from a call to ExecuteSQL

How can I explicitly close/release the result of an ExecuteSQL statement when querying a Spatialite database with OGR via Python? I have a simple query to return the SRID of a dataset. This works as ...
1
vote
1answer
68 views

List all Feature datasets & feature classes from a single geodatabase into CSV

I have prepared a python code and I got the following errors: "Parsing error IndentationError: expected an indented block (line 11)" and "Runtime error Traceback (most recent call last): ...
0
votes
1answer
22 views

Handling KML/CSV with geopandas - DriverError: unsupported driver: u'CSV'

I'm trying to import a dataset of UK postcode districts UK postcode districts from Google Fusion tables into geopandas with the aim of splicing it to a dataset of house prices. The problem is that ...
2
votes
1answer
43 views

Python to change file names in a directory

I am converting a directory of kml files to 1 single fGDB, but they all have the date as the file name. This creates a problem when using the original name because of the number at the beginning of ...
-1
votes
2answers
77 views

arcpy.Delete_management(“”) not working

I've written a script in a python toolbox. That script creates a folder in the user defined workspace for all the output files that are created during the script process. When the script is done, I ...
0
votes
1answer
40 views

Label related records in ArcMap from enterprise geodatabase

Two questions related to labeling 1:M related records in ArcGIS 10.2. I have successfully built an Advanced Label expression in Python to label records from a related table. I am currently working ...
0
votes
1answer
23 views

How can i automatically display the output of my toolbox?

i have made a python toolbox (.pyt file) and run it in Arcgis 10.1. The Output is a raster and I want it to automatically show up in the Arcmap viewer. The option for displaying the output of ...
1
vote
1answer
19 views

Find Polygon in “Layer A” containing Polygon in “Layer B”

I haven't found yet someone with the same problem, so I'm posting a new question. The topic seems quite standard, so I'm sure there's a way to do it in QGis. I have 2 layers: Region Layer Postcode ...
2
votes
2answers
27 views

Problem with accessing the layer legend using pyqgis in QGIS 2.4

I'm trying to clear the layer selection using pyqgis. It appears to me that: lgd = iface.mainWindow().findChild(QtGui.QTreeWidget, "theMapLegend") Doesn't work in QGIS 2.4 to access the layer ...
2
votes
2answers
35 views

Assigning a vector to a field in feature class (UpdateCursor)

I don't know if my mistake is of a general nature. I come from R where it is very easy to store a vector in a matrix column. So now I (new to coding with arcpy) am desperately trying to do the same ...
2
votes
1answer
82 views

Clipping Line shapefiles within extent of Polygon shape?

My question is an extension of Vertical lines in a polygon shapefile. Kindly refer to that question first. What you shall see there is a method of generating vertical lines with respect to the ...
1
vote
0answers
20 views

Ungenerate command in ArcGIS for Desktop? [duplicate]

I am searching for the ungenerate command in argis10 desktop. I get to know that is available only for workstation. But i don't have workstation. Is there any way to use this command or any other way ...
2
votes
1answer
72 views

ringer: help convert simple plugin to new QGIS 2.x

I have been trying to get this simple plug-in to work on QGIS 2.x. So far i got it to load, but it does nothing! all that it is supposed to do is place a polygon where a hole (ring) is. The code is ...
1
vote
1answer
67 views

How to calculate unique IDs starting from highest current ID

I have been using a python script in field calculator in ArcGIS 10.2 to add unique IDs automatically, however there are two things I would like to improve this process: Each ID also has letters at ...
3
votes
0answers
26 views

Overriding the QGIS Feature Dialog

We are developing a QGIS plugin and would like to override the QGIS Feature Edit Form with our own Dialog. Have explored using setEditForm and setEditFormInit, but the init process appears to want to ...
0
votes
0answers
34 views

ArcPy PointToRaster memory locking error solution?

RasterToPolygon ArcPy tool fails on generated raster (PointToRaster) with large(?) dataset. Not sure the size threshold, but fails on 78559 x 33544 raster, completes on smaller datasets so I know ...
0
votes
0answers
80 views

Transforming between epsg:3857 and Google Maps Tile coordinates

Hio, I used to use a simple python project (https://github.com/hrldcpr/mercator.py) to convert between wgs84 and google maps tile coordinates. This project doesn't have a license, and looks like it ...
1
vote
1answer
51 views

Migrating data from Python to PostGIS

I have pandas DataFrame with these columns: point datetime value 1 Point(-24.6064453125 26.3683280945) 2014-09-11 19:00:00 24.885258 2 ...
2
votes
1answer
51 views

How do I link OGR with spatialite?

Problem & Evidence: I'm trying to create a spatialite file with the code snippet below. However the outDataSource object gets assigned NoneType and all subsequent (unshown) code fails. I'm ...
2
votes
1answer
55 views

Python Use SearchCursor/InsertCursor to split attributes in fields

I download data daily and create a geodatabase table. Fields: Company, Customers_Active, Customers Total, County, State Example Data {CompanyA,CompanyB}, {141,424}, {1000,3421}, Cook County, ...
0
votes
1answer
26 views

Is there a method to determine the sources that are used in a model in ArcGIS?

I have a model that I have had to go through to model parameters in order to create a geoprocessing service. Is there a way to check all sources that are being used in the model via python? I am ...
0
votes
0answers
23 views

imposm2 to imposm3

I am using imposm2 to import osm data to postgresql database but recently moved to imposm3 which is still in development phase I want to know is there an easy way to convert imposm2 mapping file ...
1
vote
1answer
35 views

Programmatically access HTML Popup in Layer Properties ArcGIS 10.2

Is it possible to access HTML Popups (found in layer properties) programmatically in ArcGIS 10.2? I can't find any reference but thought I'd ask to double check.
1
vote
0answers
23 views

cadtool and spline plugins not working

Am trying to edit a line shapefile using a spline tool in QGIS 2.4.0 .Its drawing but the ok button is inactive. what could be the problem? Generally am trying to create a curved line.
1
vote
2answers
76 views

Vertical lines in a polygon shapefile

I am working with a GIS problem using a single input of a polygon shapefile. Consider an irregular polygon. I want to draw vertical lines across the extent of the polygon at equal spacing. How I ...
1
vote
2answers
56 views

How to concatenate double with string in field calculator with Python expression?

I'd like to concatenate my lat/lng with a few string fields in ArcGIS. What is the correct expression to use, avoiding VBA. I don't want to convert the lat/lng fields to string either. my 4 fields ...
1
vote
0answers
17 views

Python Script calling custom model failing during model execution

I have a python script that calls a model I built in model builder. If I run the model by itself it runs perfectly. If I call the model in the python script, the model errors in various locations. ...
0
votes
1answer
122 views

'List indices must be integers not tuple' Error

I'm using an insert cursor to write rows to a destination feature class where the input Shapefile field names do not match the destination FC names. To accomplish this, I'm trying to use the indices ...
1
vote
1answer
43 views

Load feature class with tab delimited file that is missing Lat/Long

I am working on a Python script that receives a nightly tab delimited flat file. This flat file has Latitude and Longitude fields and the script loads the data using the gp tools Make XY Event Layer ...
12
votes
5answers
2k views

Python is only using one core at a time to work

I noticed recently that python is only using one core at a time to work. Is there a way, maybe special builds or commands, to make it use all resources (second core)?
1
vote
1answer
46 views

How to properly import QImage from PyQt4.QtGui?

I am starting with QGIS python console. Naturally, I came across the PyQGIS Developer Cookbook. While trying to cut my way through it, I encountered a lot of problems with "undefined attributes and ...
1
vote
2answers
64 views

Error "unsupported operand type(s) for +: 'int' and 'NoneType' for variance in python

I recently came up with an error in a script I am working with in Python for ArcGIS 10.1. The strange thing about it is that this script works for some files and not for others. Any ideas as to why ...
4
votes
2answers
63 views

How to programmatically delete all inner rings of a polygon layer?

I have many polygon layers, each layer containing many polygons with inner rings. I know that you can delete a ring manually with QGis (Edit -> Delete ring). I need the python equivalent to ...
1
vote
0answers
27 views

Orthographic projection in Python Basemap

I'm trying to plot a GeoTIFF in Python using Basemap. I can do so correctly with cyl projection like this: m = Basemap(projection='cyl', llcrnrlat=LL[1], urcrnrlat=UR[1], ...
2
votes
2answers
114 views

Join Field works in ArcMap but not in Python

I am trying to join a field of values found within a DBF to a multi-polyline shapefile. They share a common field name (filename) and the values found within each are identical. I was able to run Join ...
3
votes
2answers
65 views

Script for numbering roads based on Cardinal Direction

I am kind of new to python, and am attempting to write a script that will give me a unique identifier for roads based on the cardinal direction. Ultimatley, I would like to have a system set up such ...