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

learn more… | top users | synonyms

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 ...
4
votes
2answers
380 views

How to iterate over selected layers?

In QGis by pressing shift or ctrl keys a user can select multiple layers in toc. How can a python script iterate over selected layers? I'd expect a iface.selectedLayers() but I can find only ...
2
votes
1answer
338 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 ...
2
votes
2answers
2k views

ExportToJPEG() arcpy script failure

I'm attempting to writing a python script that will automate exporting a set of stock maps to JPEG from their mxd files, and I'm having some strange issues getting there. I've alternatively been ...
10
votes
2answers
302 views

Determine minimum number of polygons from shapefile to cover an area of interest

I have a large number shapefiles representing areas of interest for an analysis that will be conducted using various sources of satellite imagery (IKONOS, RapidEye, etc.). Unfortunately, the imagery ...
9
votes
2answers
473 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 ...
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. ...
0
votes
3answers
587 views

Run function if item in QComboBox is selected

I got another issue writing a plugin to convert three shape files into an .obs input file. I created a UI (Qt) with a QComboBox to select a layer (that works fine). As soon as one of the layers in the ...
3
votes
1answer
437 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 ...
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 ...
29
votes
3answers
1k views

How to Share Open Source Python Code for ArcGIS?

My company just purchased ArcGIS software. I'll be writing scripts for ArcGIS in Python. Is there a community or open source project where this code can be shared?
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
511 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 ...
0
votes
1answer
348 views

Remove Illegal Characters in Model Builder [duplicate]

Possible Duplicate: Arcpy remove invalid character I've created a model that iterates through a shape file and pulls out unique values in a field. These unique values are then used to ...
1
vote
1answer
251 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 ...
8
votes
1answer
1k views

concurrent use of in_memory workspace in arcpy

i am using a python script that's eliminating small polygons from a feature class. this script creates temporary feature classes with fixed (hardcoded) names in the "in_memory" workspace. example: ...
7
votes
1answer
4k views

Using the python shape library: pyshp - how to convert .csv file to .shp

I am trying to understand how I can use the csv module in python to open a csv file in the same folder as the python script, and then create a shapefile using the shapefile module pyshp. The csv file ...
6
votes
1answer
2k views

Passing a variable from a script to ModelBuilder

I have a model that passes a variable to a python script. The script uses that variable to query some directories and return a list of paths. What I want to know is: how can I then use each of those ...
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
1answer
3k views

ArcGIS 10.0 \ arcpy - CalculateField_management : help with syntax for updating text in attribute table of feature classes

I am trying to add (ie "Author", "LastUpdated") to feature classes within a gdb and then populate each of those fields. I have been able to get my code to run properly for the numerical field but I ...
5
votes
1answer
2k views

How do I correctly use 'MultiValue' in Python script parameters?

My script works fine with a single feature class selected for clip_fc = arcpy.GetParameter(0) . However when I set clip_fc to MultiValue in the script properties and then select several feature ...
3
votes
3answers
788 views

ArcGIS Field Calculator Python numbering rows of fishnet

I have a grid of 100*100 cells. I want to add to each cell a number representing the row it is in (like in excel). I added a field and want try to solve that with field calculator: The code is ...
2
votes
1answer
357 views

Can you script publishing a GP service?

I have a geoprocessing service in ArcGIS for Server 10.1. I would like to share this service with a number of external organisations that also have ArcGIS Server 10.1. i.e I dont want them hitting ...
2
votes
4answers
613 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 ...
13
votes
3answers
6k views

What is the proper syntax and usage for ArcGIS “in_memory” workspace?

I am unclear how best to use the in_memory workspace in ArcGIS. The best resource I have found on the subject is from ESRI on Using in-memory workspace. Unfortunately, the help section is not very ...
3
votes
1answer
779 views

Get extents of vector shape features in python

i am just wondering if it is possible to iterate through vector features and return the extent per feature without clipping the vector shape? The code looks like this and comes from the ...
2
votes
1answer
98 views

Listing installed QGIS plugins via PyQGIS

Can you please tell me how I can programmatically (or from the console) access the loaded plugin list? I tried: QgsProviderRegistry.pluginList() but got: TypeError: ...
2
votes
1answer
372 views

How to programmatically determine whether a spatial reference factory code is valid?

I am using the following code segment to create a spatial reference. spatialReferance = arcpy.SpatialReference() spatialReferance.factoryCode = spatialReferanceFactoryCode ...
1
vote
1answer
208 views

How to add a custom SymbolLayerV2 to a Vectorlayer in QGIS

I'm trying to add a symbolLayer with a line-decoration (line-arrow) to a vectorlayer of linestrings. what i am trying at the moment is to create a new layer and set it's QgsLineSymbol with a list of ...
3
votes
1answer
633 views

Creating Selection MapTool in PyQgis Custom Application

I'm developing a custom GIS application using PyQgis API. How can I let the user select features on the map using Maptools? I would like to replicate the select feature there in Qgis to make the ...
1
vote
1answer
310 views

python multiprocessing error in QGis (Windows)

I have this error when I try to use Manager() from python multiprocessing library. (Just start QGIS open Python console and execute the two following lines) >>> import multiprocessing ...
1
vote
1answer
436 views

Why do glob.glob and gdal_translate not work for me?

I have a little problem with my python script. I wrote it to convert MODIS data from .hdf into .tif. It will convert all files in a folder using a loop. I do not know which command I must enter to ...
0
votes
1answer
857 views

Unable to delete .lock files within geodatabase using Python

I am having problems with lock files while deleting and copying geodatabases for backup purposes. print "Now backing up your Geodatabase" distutils.dir_util.remove_tree ...
4
votes
1answer
1k views

Python script for constructing a WHERE clause from user input

I'm trying to construct a where clause from user input that will eventually be passed through as a SQL statement in the select tool or the select by attributes tool. I've started a script thats been ...
2
votes
1answer
270 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 ...
1
vote
1answer
216 views

Is there any python function to rotate map layers?

Is there any python function allowing a user to rotate map layers in the map canvas. If so, could you please point this out for me? I want to rotate a map layer, using a factor of rotation in ...
4
votes
2answers
1k views

Arcpy remove invalid character

I've built a model that takes the name of the Excel worksheet containing xy data, and uses that name as the name of the output shapefile. ( Worksheet "massachusetts_sightings" in an xlsx becomes ...
3
votes
1answer
188 views

Probability distribution from list of rasters

I have 100s (exactly 224) of wind distribution rasters. I want to create a probability distribution raster of wind speed using all these rasters, so we can predict the possible wind speed in any ...
5
votes
1answer
162 views

How to Add FileGDB driver to PyGDAL installation

I installed ArcGIS 10.0 and it installed Python 2.6.5 with it. Later, I installed pyGDAL using the windows installer within that Python installation. I cannot find a specific place where GDAL is ...
3
votes
2answers
1k views

How to Open a File Geodatabase with ogr? [duplicate]

Possible Duplicate: How to access feature classes in File Geodatabases with python and gdal? I have installed: python-2.7.msi GDAL-1.9.1.win32-py2.7.exe import ogr driver = ...
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 ...
4
votes
2answers
1k views

How to programmatically work with featureclasses from multiple geodatabases?

I have produced a Python script which creates multiple buffers of specific (listed) featureclasses within a geodatabase. This is achieved by running each feature through a for loop. I would like to ...
1
vote
1answer
253 views

arcgis python window VS pywin32

I have problems while using the ZonalHistogram function in Python. It seems to give strange results, while, with the same code run in arcgis' python window everything works fine. I am trying to study ...
6
votes
3answers
680 views

How can I use py2exe with the OSGeo4W Python installation?

I have a default Python installation in c:\Python27. I have also installed Python through the OSGeo4W installer, which has created a "sandboxed" Python installation with all the geospatial bindings I ...
9
votes
1answer
2k views

Creating table containing all filenames (and possibly metadata) in File Geodatabase?

I need to create a metadata-table for all files in a File Geodatabase or Spatial Database. It would be awesome if it were possible to automatically be updated with new filenames, and possibly even ...
5
votes
3answers
4k views

How to create lines from points pair coordinates with arcpy?

I've got some points pair coordinates (start and end points) which I have to transform into lines. Until now, I used an append of both the coordinates in a pippo.Point(), a pippo.CalculateGeometry() ...
5
votes
3answers
1k views

How do I get the path of a project, or layer file in PyQGIS?

I am generating new raster files from vector layers on a project. I would like to save them in the same directory as the project or layer files. How do I find this path using PyQGIS?
49
votes
10answers
4k views

Alternatives to using Arcpy

I seem to use ESRI's Arcpy site package for virtually all of my python geoprocessing. To ESRI's credit, these are an incredible suite of tools that can help accomplish a great deal. However, I would ...
1
vote
1answer
143 views

QGIS python plugin, segmentation fault, what can I do?

I'm trying to write a python plugin to create an input file for an urban climate model out of three shape files. Unfortunatelly QGIS closes when I try to load the plugin. When I start QGIS from the ...
0
votes
1answer
102 views

How can i use ihookhelper interface in python?

I use ArcObject in python to develope a tool. I import comtypes in python to access the arcmap layers in python and use ifeaturelayer interface. I have to set featurelayer to ...