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

learn more… | top users | synonyms

0
votes
0answers
12 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
84 views

Installing Pandas in ArcGIS 10.2 for Desktop?

I followed the very clear directions in the answer to Installing pandas with Esri's python? and created the Esri101 build and added a "conda.pth" file to my ...
1
vote
1answer
63 views

Compare features attribute

I have a polygn layer and each polygon has the MEAN elevation as an attribute. I want to write a python script to select each polygon and compare its elevation with its neighbouring polygons and store ...
1
vote
0answers
20 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
1answer
376 views

Converting Tab to Shp Using OGR2OGR with Python on linux

First i downloaded http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogr2ogr.py and i am importing this. How can i get ogr2ogr to run in my script? nothing seems to be working and i not sure ...
1
vote
0answers
16 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. ...
1
vote
2answers
48 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 ...
0
votes
1answer
73 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
40 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 ...
3
votes
1answer
858 views

Multiline VBScript Label Expressions in Arcpy

I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using ...
1
vote
1answer
35 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
37 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 ...
2
votes
1answer
167 views

Python problem visualization .tif image

I am trying to read a hyperspectral image in Uint16 .tif format and visualize it. I use GDAL in Python to read the data and everything works perfectly when I use matplotlib to show one band of the ...
4
votes
2answers
45 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 ...
0
votes
1answer
171 views

visualize bounding box to a polygon

I try to make plugin in QGIS that compare 2 bounding box data, ex: (-32.61442167739459, -32.017601026186576, 13.015663782506067, 13.428145228091406) and (-38.6102467739459, -38.017601026186576, ...
3
votes
0answers
56 views

Problem with performance when loading PostGIS layer using pyQGIS

I'm having a question on loading a PostGIS layer into the project from my QGIS plugin. The code is like this: uri1 = qgis.core.QgsDataSourceURI() uri1.setConnection(str(host), str(port), ...
2
votes
0answers
46 views

Run a large model by calling it in a python script?

I've created a rather large model containing a sub-model that calculates the volume of water basins(playas) in a relatively flat area of Texas. The volume is taken from one foot slices of each each ...
1
vote
2answers
96 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 ...
2
votes
1answer
50 views

How to detetmine county of GPS coordinate?

I have a SHP file that contains all counties in the USA. I also have roughly 100 million GPS locations. I need to tally the number of GPS locations per county. A linear search through the counties ...
1
vote
0answers
22 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], ...
3
votes
2answers
635 views

Issue Trying to create Zonal Statistics using Gdal and Python.

I am trying to create zonal statistics using Python and Gdal. I have a polygon shapefile and a raster file, and in order to do so, I am using a piece of code I found in StackExchange. The raster and ...
0
votes
2answers
151 views

ArcGIS 10.2.1 Table To Table tool in Python script gives ExecuteError: ERROR 001156?

I work for an organization that just upgraded from esri arcmap 9.3.1 to 10.2.1 and I'm currently in the process of updating the python scripts. When running a script I'm getting hung up on a portion ...
2
votes
1answer
159 views

How to construct a line from points in pyshp?

I am reading a shapefile for a pipeline and what I've noticed is that if I just draw a line from one point to the next (in the order I read them), there will be points where the line terminates, and ...
1
vote
1answer
73 views

List layer names from Map service using python

I am trying to get a list of layer names within our rest services for all services and folders. I have two codes that I am trying to put together and for some reason the layer code doesn't seen to ...
5
votes
1answer
107 views

Is it possible to drive one mxd (pan) using a different mxd with python?

I have 2 mxd's. mxdA and mxdB They both show different data, but are both in the same coordinate system. I want to be able to sync mxdB with mxdA, so that if I pan / zoom in mxdA, I can then, with ...
4
votes
1answer
319 views

QGis Zonal Statistics Plugin NoData included in Calculations

I have been trying to use the QGIS zonal statistics plugin. My raster has a nodata value of -99999 and all other values are positive. After computing the mean zonal statistics there are a number of ...
1
vote
1answer
169 views

PGRouting Layer plugin error in QGIS 2.2

I am trying to do some basic computations using the PGRouting plugin for QGIS, but I am getting this error all time: An error has occured while executing Python code: Traceback (most recent call ...
2
votes
1answer
40 views

Python loop with address locator

I was given a list of addresses without any zip codes, and I'm trying to write a python snippet that will loop through a set of possible zip codes and make a set of geocoded shapefiles that I will ...
0
votes
1answer
86 views

Plugin QGIS Error “QTextEdit.setPlainText(QString): not enough arguments”

I try to make save as button but i got this error message when try to save file in my directory File "C:\Users\Mr.Pakde/.qgis2/python/plugins\condition\conditiondialog.py", line 80, in saveAs ...
1
vote
1answer
38 views

Error on FeatureClass To FeatureClass conversion arcpy

I am currently working on a python script where I am trying to copy selected features into a feature dataset. Basically I have an mxd containing some layers, and for each layer I select features by ...
2
votes
2answers
170 views

Issue while running grass from subprocess

I have a map based web application using geodjango. I needed to display the crime hotspots within a selected polygon area. I found that v.kernel is very good for generating heatmaps/hotspots. So in my ...
2
votes
0answers
18 views

Run an ERDAS Imagine pmdl (or bcf) via Python?

How (or is it) possible to run an Erdas Imagine .pmdl model from a Python script? I have successfully run .eml models but cannot get the syntax right for .pmdl Here is what the line I want to run ...
1
vote
1answer
58 views

Using GDAL to read dted files

How do I get the elevation at a certain point using gdal to read in a dted file? I don't see much useful information out on the web. I'm sorry I should have been more specific. How would I ...
0
votes
1answer
36 views

Create Georeferenced Raster For JPEG file with Mapnik Python

I am able to use Mapnik generate_image.py to generate image with a BBOX and projection. Also, I have added a python script to generate a JGW file. But to completely georeference the generated image. ...
3
votes
1answer
114 views

Why is this field calculator expression evaluated incorrectly when using Python syntax?

I have a polygon featureclass containing an integer field 'gridcode'. I've added 2 new float fields VB_calc and Python_calc, both of which should be equal to gridcode / 1,000,000. If I calculate the ...
1
vote
1answer
264 views

Calculating Stream Length-gradient Index (Hack Index) with the field calculator

I'm trying to calculate the Stream Length-Gradient Index of a stream (example data below). Just started to get into python, but am struggling with a solution to this problem. I have 42 streams to run ...
2
votes
2answers
731 views

OSR Python testSR.ImportFromEPSG(4326) returns empty spatial reference

This is empty using Python .ImportFromEPSG(4326): import osr #this fails: testSR = osr.SpatialReference() testSR.ImportFromEPSG(4326) print testSR.ExportToPrettyWkt() #why did the import from EPSG ...
6
votes
5answers
1k views

What Avenue scripts/extensions do you still keep ArcView 3.x around for?

Alternatively, if you've completely moved on, which do you miss the most? Thanks and signed,     Not entirely idly curious. (As a side project, I'm looking into the effort ...
26
votes
9answers
5k views

What are some resources for learning ArcPy?

I would like to learn ArcPy, but I do not know quite where to begin. Does anyone have any good advice on where I should start to learn ArcPy?
1
vote
0answers
31 views

How to write in only a file .csv (or .txt) the values contained in several rasters?

I am an beginner in Python programming but I would like to write in only a file .csv (or .txt) the values contained in several rasters. For example, I built several rasters by using a loop. The ...
1
vote
1answer
28 views

Point input for polyline not acceptable?

Input QgsPoint(s) are returning an error in a Polyline creation routine. Any clues?! processing.runandload("qgis:polygoncentroids", Base, "memory:CenterNode") ...
2
votes
2answers
428 views

How do I prevent Qgis from being detected as “not responding” when running a heavy plugin?

I use the folowing line to inform the user about the status: iface.mainWindow().statusBar().showMessage("Status:" + str(i)) The plugin takes about 2 min to run on my data set but windows detects ...
0
votes
2answers
2k views

Cause of expected an indented block error in Python script?

I have been trying to list all the field names of a shapefile but it is showing 'expected an indented block'. What should I do? import arcpy fieldList = ...
2
votes
1answer
547 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
5
votes
1answer
479 views

How to programmatically associate a layer with a custom UI?

I know it is possible to associate a layer with a custom UI for editing feature attributes using the QGIS interface. But is this possible with Python? This link shows how to achieve the result ...
2
votes
1answer
290 views

View HTML field data with QT4 browers as a QGIS Run Feature Action Tool

I've successfully populated a sqlite table with an HTML-encoded-table as a field attribute, and so there is literally a Table within a single field value in sqlite, for each record. This is going to ...
3
votes
1answer
247 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
0answers
25 views

GeoDjango WebMapping Application Update

According to the below GIS.SE questions, GeoDjango was the preferred framework for creating simple and quick webmap applications. But these questions are now all 2-3 years old. Can we verify whether ...
1
vote
1answer
60 views

How to delete features/records in ArcGIS Server using Python

How can I use python to delete records from a table, or features from a featureclass, when they are stored in ArcGIS Server? using REST "delete features" in arcgis api for javascript shows ...
3
votes
2answers
90 views

Efficient way to use a CSV to Define a Feature Class

I was provided an Excel Spreadsheet which had the definitions of fields for a feature class. There were several worksheets in the file, each containing field definitions for different feature ...