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

learn more… | top users | synonyms

4
votes
1answer
570 views

Using group by to set a PostGIS datasource using QGIS Python API

I am writing a QGIS Plugin and wish to obtain data from a PostGIS table using the Group By clause using something like the following code: uri = QgsDataSourceURI() uri.setConnection('localhost', ...
1
vote
1answer
219 views

Count the number of symbols in a 'new symbology' renderer from pyqgis

Background : I create a lot of symbology using 'saturation' ramps - for want of a better term, e.g. where the hue and value of each symbol stays the same, but the saturation changes. I couldn't figure ...
8
votes
3answers
8k views

How to create a button in Arcmap 10 to run a Python program?

I have a script that I want to run within ArcMap when a button in a toolbar is clicked, and so far I have only been able to make the script into a script tool. I need it to run as a command, not as a ...
8
votes
3answers
824 views

Are there any training resources in SQL and Python as applied to GIS database management?

I've taken ESRI database courses, which have been helpful to my work. But I also need training in SQL and Python as applied to GIS database management. Any suggestions?
6
votes
2answers
702 views

How to add GDAL to existing Python installation?

I would like to download and install GDAL for Python version 2.6 [MCS v.1500 32 bit(Intel)] on win32 that supports reading FileGDB's with Python. But I am not sure how to go about this. I found one ...
3
votes
2answers
290 views

How to generate Buildings ID numbers inside parcels

In order to decrease manual data entry, I would like to automate a task to generate numbers for all buildings inside a parcel starting with 1. For example, I have 4000 parcels and each parcel has ...
5
votes
1answer
1k views

How to update shapefile data source in multiple dataframes and mxds using lyr.replaceDataSource and Python dictionary?

After reorganizing the file structure for some of our GIS base data files I need a script to update the data sources for ~ 100 shapefiles in about 50 mxd files. Some of the mxds have multiple data ...
11
votes
1answer
2k views

How to access feature classes in file geodatabases with Python and GDAL?

I am trying to access a vector dataset in a ESRI File Geodatabase using Python + GDAL. I have successfully compiled GDAL with the file geodatabase API. The FileGDB driver is working correctly since ...
4
votes
1answer
899 views

book/tutorial on using rpy2 in python for kriging?

I am proficient in Python, but have no knowledge of R. Can you suggest a good tutorial in using rpy2 or any other R library to perform Block/Cokriging "Kriging"
3
votes
1answer
254 views

How can I put coded domains into a list to be created in python script?

I have a large list of coded domains. They are numbers like: 01.6530.01, 05.7991.08, 05.7991.01, 05.7991.06 The code will be the exact same as the description. I've tried to make a list using: ...
3
votes
2answers
2k views

Getting values from attribute table and inserting another table

I have line feature class of a river network and “FromTo” table. Lines are dissolved so they are not segmented from junctions. I need to write a Python script in ArcGIS to do following: Begin from ...
3
votes
2answers
252 views

Process every 100 records in list

An arcpy merge process is failing due to the size of the datasets and I need to just merge every 100 tiles before it goes on to the next 100 tiles. I wrote the following snippet but it is just ...
8
votes
1answer
1k views

How to make a new raster using con() script in Python?

I'm new to Python and have been trying to code a raster calculator style script. Basically, I want to convert a raster that has values 0 to -10,000 into a raster that is populated by 1s between ...
1
vote
1answer
487 views

How to add a progress bar to a python plugin?

I would like to add some type of progress bar to my Qgis python plugin. Can someone point me to an example?
8
votes
1answer
365 views

How to see what lines have changed in an updated Shapefile?

I'm using my county's GIS data to update the roads in OpenStreetMap. I have a copy they published last year and one that was just published, and I'd like to find all the LineStrings that have either ...
2
votes
0answers
57 views

Is there a way to distinguish between digitized and pasted features?

Is there a way to tell if an added feature in QGIS is in fact a newly digitized one or a pasted feature? I think QGIS is treating both cases in the same way, emitting the same signal: ...
5
votes
1answer
100 views

Is it possible show the feature attributes dialog when I add a feature in code?

I want to know if it is possible to make the feature attributes dialog in Qgis show up when I add a feature by code using: QgsVectorLayer::addFeature( tFeature ) This is available when I add ...
2
votes
2answers
155 views

How to use model-builder iterator with a custom bit of arbitrary code?

How do I integrate a in-line variable from modelbuilder into a python script? Specifically, I'm using an iterator, and I'm trying to include the 'name' variable in a python script. I believe the ...
3
votes
1answer
114 views

Is there any way to speed up the script I wrote?

I have a pretty simple script which gets 2 parameters from the user: 1)Geodatabase location 2)Spatial reference It then creates a dataset with 6 feature classes. It also adds a large amount of ...
2
votes
1answer
267 views

How to get all attributes from a non geometry PostGIS layer with Python in QGIS?

I want to extract all attributes from a non geomety layer in QGIS with Python, but there is only the function uniqueValues(fieldIndex) More specific: I have a postgresql table which is loaded into ...
3
votes
2answers
557 views

Using 'gdalwarp' in Python script for Grass

I'm writing a Python script that aims to re-project various LANDSAT tiles into a common projection and then import the tiles into Grass. The script at present is shown below: #!/usr/bin/python ...
8
votes
2answers
500 views

How to add different sized rasters in GDAL so the result is only in the intersected region

I'm writing a Python method that adds two rasters and generates a single raster output. For reasons beyond my control, the extents of the input rasters are different, but they do overlap. Is it ...
6
votes
1answer
404 views

How to draw shapes with highest possible decimal accuracy

I am trying to read input of lat and long to draw the shape based on condition.The input is standard array of lat and long with 15 decimal accuracy. I am realizing - I am loosing some decimal accuracy ...
2
votes
1answer
317 views

Convert a List to a file list to use in an arcpy tool

I just can't figure out how to feed a list of files into an arcpy tool... I have List_tif.append(os.getcwd()+"\\Stage1\\"+name+"\\GeoTif\\"+name+"_"+str(ddp.pageRow.PageName) + ".tif;") That ...
1
vote
0answers
173 views

zonal statistics in Python crashes

I have a python script that works (it's worked for several other projects in the past and it worked for my current project initially). But whenever I run it, Python crashes sporadically. It would go ...
1
vote
0answers
91 views

How to get the geometry of a polyline to a specific precision?

In python, I use point = geom.asPolyline() but it looks like I am not getting any precision just whole numbers? How can I get the geometry and a certain precision?
4
votes
2answers
211 views

FindLabel not Defined

I'm trying to make an advanced label expression using the python parser and I keep getting the following error: def FindLabel ( [Direction] ): return "{}° {}' {}\"".format( ...
2
votes
0answers
34 views

How can I set python path and version for QGIS? [duplicate]

Possible Duplicate: Couldn’t load SIP Module When I'm starting QGIS I'm getting the problem: "Couldn't load SIP module. Python support will be disabled." And there is also: Python version: ...
5
votes
2answers
994 views

How to improve Python script processing speed (performance)?

I've been working on a script which essentially reads in a large amount of point and polygon data and generates frequency values for a featureclass of 2.5 acre hexes covering California. I have found ...
3
votes
1answer
576 views

How do I programmatically export a single Data Driven Page to JPEG?

I am trying to write a python script to export a individual pages to a jpeg. I am getting the error "PageLayoutObject: Error in SetDataDrivenPageID". Can anyone see where I am going wrong? import ...
7
votes
1answer
407 views

Migrate python scripts from 9.3 to Arcgis10

What changes are needed to migrate scripts from the ArcGis 9.x environment/gp-object to the ArcGis 10/arcpy environment? Can anyone provide a good overview what the changes are? Can someone share ...
13
votes
3answers
4k views

Writing numpy array to raster file

I'm new to GIS, and I'm lost with something I feel ought to be relatively simple. I have some code that converts infrared images of Mars into thermal inertia maps, which are then stored as 2D numpy ...
1
vote
1answer
126 views

Selection on Feature layer (geoprocessing)

I have a feature layers with states and counties fields. I want to make a selection tool. Tool dialog should have input for feature layer and two drop downboxes for states and counties. When user ...
2
votes
1answer
347 views

Edit Shapefiles Attribute data in GeoServer Programatically

I'm rendering a shapefile using GeoServer and using OpenLayers library to render it in the web browser. Now I have created the option of editing the attribute data in web browser. I want the edited ...
3
votes
1answer
171 views

How to get raster layer pixels contained in a shape defined in a vector layer

I am new in QGis python plugins dev and I have a "maybe stupid" question (in the title :-) ). I try to retrieve pixels (from a raster layer) which are "contained" in a polygon defined in a vector ...
9
votes
2answers
3k views

Python scripts that run inside ArcMap vs ones that run outside?

I'm just starting to get into Python scripting for work.. I'm currently creating a script to automate a process. Basically, it asks the user the client name, gets a projection if available, creates ...
4
votes
2answers
345 views

How to pass an output stored in a single variable into another script using arcpy

I am running set of processes each with different outputs in a python script. Is there a way to set a variable as global so that just the output of that single step can be accessed from other scripts? ...
1
vote
1answer
385 views

Does arcpy have an issue with directory names starting with a number?

I have a script to export DDP extents to tif and when I change arcpy.mapping.ExportToTIFF(mxd,"tests\BA\BA10k_" + str(ddp.pageRow.PageName) + ".tif",df,9306,9306*ar,1800,True) to ...
1
vote
1answer
124 views

Extending ArcGIS

I've been tasked with a thesis project where i have to extend the features of ArcGis. I've been asked to create a model written in Python that can run out of ArcGIS 10. This model will have a simple ...
4
votes
1answer
3k views

How to convert WMS to SHP?

I'm looking for tool that will be convert WMS to vector layer. Are they ready tool?(for example in python)
4
votes
3answers
1k views

Copy dbf data into a shapefile in Arcpy

Basically it's to perform a one-to-many join in a python script, from a dbf to a shapefile. I saw (Greg Krakow's method) using QGIS, but I can't use it (I'm working on it, but QGIS is not yet ...
3
votes
2answers
1k views

From text data create a FeatureClass with table with python

I'm searching how the output of one program (text file with some writings, but also with data as numbers, dates, times, coordinates, all separated with commas) can be transformed to a Feature Dataset. ...
2
votes
1answer
333 views

Can I Dynamically Update Symbol Ranges?

Background: I'm currently trying to dynamically change the ranges for a layer with new style graduated symbology. Problem: I thought it may be as simple as updating the ranges for the existing ...
9
votes
2answers
472 views

Best design for Open Source Python / PostGIS prototype

I am writing a data intensive web application that is delivered through apache. My question is about how to best arrange processing given that there are multiple options. I have at my disposal ...
0
votes
1answer
1k views

arcpy - how to run geoprocessing python script on SDE

I was testing my script on a .gdb on my local drive and I got it to work. The actual geodatabase I would like to run the script on is an SDE. I tried changing my filepath from the .gdb to the .sde and ...
2
votes
4answers
597 views

What is causing syntax error in arcpy NetCDF Raster script

I'm trying to save the raster layer in the stand-alone python GUI but I keep getting a syntax error. I'm using the code from Save To Layer File (Data Management). And the error that shows up is: the ...
1
vote
1answer
249 views

Any advice to help troubleshoot failing ArcGIS Server (10.0 sp5) Geoprocesses?

There are a few geoprocesses on a recently restored ArcGIS Server that are behaving strangely. If we turn on 'show messages' and try to run the process from the rest interface, the process will report ...
3
votes
1answer
428 views

How to convert a string from GetParameterAsText to uppercase?

This is my first question here and I'm sure it's ridiculously simple. But I have Googled and no luck. I am trying to make a tool in ArcToolbox using a Python script so users can input a street and ...
0
votes
1answer
3k views

function, return, 'instancemethod' object has no attribute '__getitem__'

I'm still trying to write a python plugin to create an input file for an urban climate model out of three shape files. Now I stumbeled into another problem, that I think is an easy one, but I just ...
2
votes
2answers
499 views

How to single out country data from a world data map?

Say that i have two "data sources"; A global map of average wind speeds, A shape file (or similar information) of all country borders in the world. How do i combine these two sources and extract ...