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

learn more… | top users | synonyms

1
vote
1answer
30 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
30 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
38 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
19 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], ...
1
vote
2answers
92 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
58 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 ...
2
votes
1answer
46 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 ...
2
votes
0answers
42 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
1answer
60 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
105 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 ...
3
votes
0answers
54 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
13 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 ...
2
votes
1answer
38 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 ...
1
vote
1answer
49 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 ...
4
votes
3answers
110 views

How to get a list of attributes in FME when there are no records in table?

How to get a list of attributes in FME when there are no records in the table? I try use a PythonCaller but when there are no records, FME passes over this table. In PythonCaller I write: import ...
0
votes
1answer
28 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. ...
1
vote
1answer
37 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 ...
3
votes
1answer
113 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
76 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
0answers
29 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") ...
1
vote
0answers
20 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
56 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 ...
1
vote
1answer
47 views

Extract Values to Points between rasters and point shapefiles of the same name

I have a task of extracting raster values to point shapefiles, which is simple enough, but only where the raster filename is identical to the shapefile. For example, I have shapefiles "G1", "G2", ...
1
vote
0answers
43 views

How to load style from postgresql?

Is there any way to load a postgresql style for a vector layer using python? There is a function: loadNamedStyleFromDb (const QString &db, const QString &theURI, QString &qml).Does it ...
3
votes
1answer
35 views

Merging .dbf Tables in Python w/o merging all fields of same name

I'd like to merge several tables together using Python. They all have the same field names: "TIME", "X", "Y", and "VALUE". I would like the "VALUE" fields to remain separate when merged, so that the ...
1
vote
1answer
32 views

Problem with variable for arcpy.select_analysis whereclause

I have a problem with the whereclause on python for arcpy.Select_analysis. I try to use a variable for condition: for row_stat in rows_stat: % for calculated the variable"maxi" ...
2
votes
0answers
33 views

Python and gdalwarp: change resolution of raster

I am new to GDAL and have been having some hard time figuring out how to change a raster's resolution and how to align it to another existing raster. I have come to the point where I have a raster ...
1
vote
2answers
28 views

Parcel Map - How Many Acres of Feature X fall Within Each Parcel

Can someone recommend a good tool for ArcGIS that would help summarize how many acres of a polygon feature occur within each parcel in a separate layer. I have a layer containing a few hundred ...
3
votes
0answers
71 views

How to compute (X,Y,Z) of a point from given attributes

Is there a way to compute the geodetic coordinates (Earth Centered) of a satellite S(x,y,z). The original problem is to compute the footprint of an antenna, given the following information: ...
1
vote
0answers
18 views

Problem Loading Plug-Ins in QGIS 2.2 on Mac

I'm trying to load the 'processing' module in QGIS (2.2.0-Valmiera on Mac OSX 10.8). However, this module and others (e.g. GarminaCustomMap) re failing to load with a message: ImportError: No ...
0
votes
2answers
51 views

GDAL for Python: extracting subdomains from NetCDF file?

I need to make a script that processes a NetCDF file that contains 3 days of hourly forecast data from the norwegian meteorological office. The NetCDF file contains various data I need ...
3
votes
0answers
42 views

Create vector grid from canvas using script

I've modified "Hex grid from layer bounds" script to my need. Just added cellsizex and cellsizey. Changed the hexagonal - 3 to "1" to make it as a square grid. Is it possible to include an option to ...
1
vote
1answer
33 views

Standard SQL with ArcGIS

Is it possible to use Python to run actual standard SQL on an enterprise geo-database? Think about batch deleting, joints, etc moving beyond just the cursor objects in Arcpy. Note that one can ...
0
votes
1answer
21 views

Detecting Runtime Errors in Arcpy Loops [duplicate]

I am looping over a feature in Arcpy and doing several geoProcessing tasks on each feature/iteration. The loop runs pretty well but crashes on some of the features. I dont really know why but its ...
2
votes
1answer
42 views

Basin numbering according to Pfafstetter Method?

I would like to divide my basin into subbasins and numbers according to the Pfafstetter method. Is there an easy way to implement this in Python using ArcPy? Or are there some freely available ...
0
votes
0answers
49 views

ArcPy loops/cursors faster without background processing?

I am running loops via cursors and raw Python in Arcpy. Within the loop several processes take place, selecting shapefiles and converting to raster, clipping, running euclidean distances, extracting ...
5
votes
1answer
99 views

Pause ArcPy script until feature class lock goes away

My script needs to copy data into a feature class to an SDE geodatabase that might have a lock on it from another application. I shouldn't break the lock (that app has priority over a data update), ...
2
votes
2answers
54 views

Batch Conditional Test - For Loop with a Group of Rasters

Edit: Question was answered. Please scroll to see fixed script. Thank you everyone who helped! How do I ask a “for loop” to operate on groups of three files folder (e.x. files A, B, C), then files ...
1
vote
0answers
27 views

Mapping from one plane on the other plane despite of masking regions

have a set of data given here, where in the first and second columns there are the sky coordinates (ra,dec) e.g. right ascension and declination, respectively and in the third and forth, the ...
0
votes
1answer
54 views

Cannot load postgis layer from sql string in pyqgis

I'm trying to load a layer using the following code in qgis python console: sql = "(select the_geom, ID from mytable)" uri = QgsDataSourceURI() ...
1
vote
1answer
43 views

What's the reason for this Invalid Layer “Cannot open GDAL dataset …” error

When adding a rasterfile with QGIS python console there appears an error when the first letter of a rasterfile to be added is not written in capital letters. Why this behaviour? Example case1: ...
0
votes
1answer
35 views

D8 algorithm to get the flow direction in ArcGIS

I am using ArcGIS 10 for the get the flow direction from DEM. I wonder about the algorithm they have used while calculating flow direction. It is mentioned there that it is using D8 model. D8 model ...
3
votes
2answers
69 views

Converting huge multipolygon to polygons

I have a shapefile with some huge multipolygons, with 100.000's of parts. What would be the easiest way to split them to singlepart polygons? I'm looking for something like QGIS ”Multipart to ...
1
vote
0answers
47 views

Creating symbology by category in python?

I'm trying to create a python script that creates color-coded symbology by county for multiple maps with different data. I've never created a layer file for the purposes of symbology before, but I ...
2
votes
2answers
39 views

Rename las files with Python [closed]

I have a bunch of LAS files that have been delivered with different naming conventions. I want to rename the files to all have the same uniform naming - based on the easting and northing coordinates ...
3
votes
1answer
27 views

How to find the distance between start of line and start of raster with arcpy/python?

I'am creating a python script tool for ArcGIS Desktop 10.1 to extract profiles. I’m using stack profile to extract values to a table but stack profile only outputs values where the line and raster ...
0
votes
1answer
26 views

QGIS Python console - save image from bounding box

I want to save an image from QGIS but the save image functionality feels limited. My question is if it's possible to use the python command line to save an image at a specific zoomed in scale and to ...
1
vote
1answer
27 views

pyQGIS - Data Source is Invalid

Why I am getting Data Source is Invalid in python console of QGIS when running: vlayer = QgsVectorLayer("home/sanjayr/Desktop/india-latest.shp/buildings.shp","sanjay","ogr") I am using QGIS 2.4 on ...
2
votes
1answer
48 views

Unicode Decode Error for shapefile in Python

I have Python script for converting shapefiles to Geojson. My code works well if I use some usa data, but when I want to use some other encoding, it gives me this error: Traceback (most recent ...