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

learn more… | top users | synonyms

1
vote
1answer
91 views

Other than the methods stated on the Desktop 10 Sharing Tools section, are there any other ways to distribute custom toolscripts?

Essentially I want to be able to distribute a custom script and it seems that I cannot create a .tbx file, so I looked into the other methods, but they are all only for Python modules it seems. What I ...
1
vote
1answer
294 views

How to get a composition name in Qgis python console?

In Qgis python console: I want to populate a list with compositions names, like in Composer Manager, but I can't figure out how to get the names (titles). So far: composerlist = ...
2
votes
1answer
335 views

How to add Real Attributes to Shapefile using pyqgis?

I created the Qmarxan plugin using the fTools plugin as an example base. When I create a new shapefile using the QgsVectorFileWriter function I don't have any difficulty specifying a "Real" field with ...
8
votes
1answer
2k views

Polygon overlay with Shapely

I'm trying to capture all the non-overlapping polygons indicated below using Shapely (given polygons A,B & C). Moreover, I'm hoping to do so without iteration, testing for intersect etc. The ...
2
votes
1answer
204 views

iterating and exporting all combinations of features as shapefiles

I am trying to export individual shapefiles of all 2 pair combinations from a multi-feature polygon shapefile. To explain this better as set of FID's 0, 1, 2, 3, 4 would be exported as individual ...
4
votes
1answer
759 views

Bing's geocoder with GeoPy not returning a zipcode

I'm just getting started with GeoPy and have been running some tests to determine the quality of the different available geocoders. I have noticed that Bing's geocoder is more accurate than Google's ...
2
votes
3answers
1k views

Batch convert ArcGIS 9x files to 10

I would like to convert all mxd's in a directory and it's subdirectories to ArcGIS 10 mxd's. This is so that I can then run python to automate some updates within them. Is this possible? This is my ...
2
votes
1answer
543 views

How to switch to a GDB created in the middle of a script

EDIT: Here's my full script and hopefully a better way of explaining what I need done: #Import import arcpy, sys, os # Set environment settings arcpy.env.workspace = sys.argv[1] inFiles = ...
1
vote
1answer
235 views

Small issue with field calculator

What am I doing wrong in this field calculator logic? Pre-logic def re_score(elev_t,f2, contour): f2=contour if elev_t.endswith('.5'): f2 = "Midi" return f2 Expression for field "Contourtyp" ...
2
votes
3answers
1k views

Qgis Python code library documenation.

I'm looking for python documentation for specific operations in the Qgis python console. I know there is no suggestions simular to Arcpy but I would like a pure list of operation code lines as ...
1
vote
1answer
551 views

Spatial Analyst Cell Statistics tool in Python gives inaccurate results

My question is similar to the Cell Statistics gives Wrong Answer question. In Python, I'm using the MINIMUM parameter to execute the cell statistics tool on several reclassified rasters ('0's and ...
2
votes
0answers
157 views

Are there Plugin Compatibility Issues between QGIS 1.6.0 and 1.7.4?

I've been working on a QGIS plugin on Quantum GIS 1.6.0 Copiapo with Python 2.5 that calculates additional values for eachf feature of a vector layer and adds them to the .dbf. We've just upgraded to ...
1
vote
2answers
813 views

arcpy.Delete_management not deleting

I'm struggling with deleting an mxd in a for loop. My code is: import arcpy, glob, os, datetime, time from time import strftime for filename3 in glob.glob(os.path.join(folderPath, ...
1
vote
1answer
211 views

Index out of range error when cleaning up variables

I'm running a script that parses points from a flat database structure into individual feature classes with related tables. A search cursor runs through and stores each field's data in a variable ...
5
votes
2answers
575 views

Accessing non-spatial PostgreSQL tables using OGR Python bindings

When connecting to PostgreSQL/PostGIS using the OGR Python bindings is it possible to get non-spatial table names (i.e. OGR layers) from the connection? Currently, doing: conn = ogr.Open("PG: ...
2
votes
2answers
128 views

Finding Two locations with a conditional search on DEM

I want to find two locations H difference in elevation between two locations on a DEM. Ex: point A and B are my output after search on DEM. conditions are (1)buffer R distance around point A and (2) ...
2
votes
1answer
316 views

Use arcpy.SearchCursor with raster

How can I efficiently subdivide one raster into multiple rasters using the arcpy.SearchCursor? For example if I have a slope and I was to subdivide into 3 rasters: slope1 with values between 0 and ...
4
votes
1answer
1k views

Sorting a table on multiple fields using ArcPy

I'm trying to sort a table based on three fields with ArcPy (which should be only one line of code), and I had a "tool is not license" error. I just saw that sorting with multiple fields as parameters ...
5
votes
0answers
606 views

How to get rpy2 for QGIS on OSX?

I am a new QGIS user, have installed QGIS on a Mac running Snow Leopard OSX 10.6.8 following all the instructions. QGIS seems to work well for everything other than when I boot up I get the message ...
0
votes
1answer
1k views

How to find Q in m3/sec from a raster having Q in mm for hydro power calculation

I am having a raster file with runoff depth Q in mm which was obtained from SCS method. I want to calculate hydro power potential at any location on my DEM. In the formula Q is in m3/s but we are ...
6
votes
3answers
5k views

Programmatically start and stop map services with Python

Is it possible to programmatically stop and start ArcGIS Server map services using Python?
2
votes
1answer
1k views

Error getting while creating new field to a shape file table

i am getting the error for following code to add a new field to a shape file table. from osgeo import ogr # Open a Shapefile, and get field names source = ogr.Open('my.shp', 1) layer = ...
2
votes
4answers
3k views

Basic Field Calculator help

I have no experience with Field Calculator in ArcGIS 10. I have a very simple calculation I would like to perform that I could do easily via pure SQL but just can't seem to get my head around it in ...
2
votes
2answers
259 views

What are my hosting options for an app that needs tilestashe along side a django app?

I'm building a GIS webapp that uses tilestache to serve MBTiles and a django app to serve geoJson. I'm having trouble understanding exactly what kind of setup I'd need to host this. I'm new to server ...
2
votes
2answers
1k views

ArcGIS and Python Issues with Different Versions

As we know, there are few versions of Arcgis (9.x,10) and Python(2.x,3.x) are in use. Issues are facing when we run scripts/toolbox of arcgis since the script written in one version of python and the ...
0
votes
1answer
484 views

ArcGIS: Extracting data from large intersect dataset

I have a big dataset imported into ArcMap. For each point, I created a buffers of 200m. And I apply Intersect to all the buffers, resulting in a huge dataset of around 2183962 objects. Previously, I ...
0
votes
1answer
440 views

Trying to make xml data readable for Arcgis

I am trying to convert xml data into tabular form for the process of geocoding. We have the xml file with info that we are going to run through an address locator. Do I need a script for this? Can ...
2
votes
1answer
608 views

How do I change a raster's geotransform with GDAL?

I'm trying to use GDAL to set the geotransform of a new raster that I've created by following the steps outlined in the GDAL API Tutorial. # create the new dataset driver = ...
2
votes
0answers
226 views

Recalculate Quantile Breakpoints in CalculateField_management loop?

I have a program that iteratively replaces a temp field where I choose a certain symbology (color ramp and quantile color break methodology) with a few other fields from a join. The program works in ...
2
votes
1answer
2k views

Use ArcPy to rename MXD layers

I have a MXD with some layers that have parentheses in them. I'd like to rename them via script. Is this a valid approach? import re map = arcpy.mapping.MapDocument("CURRENT") layers = ...
6
votes
1answer
734 views

How to attach GP script tools, standard tools, and Python script to a toolbar?

I need to build a custom toolbar that can launch the following items: A Python script tool - shouldn't be a problem, as you can already attach these to a toolbar Out of the box functions such as the ...
2
votes
3answers
1k views

Tracking change with ArcSDE/Oracle

I'm looking for the simplest way to track changes ([delete, update, create] feature(s)) made to the DEFAULT version of a given feature class in ArcSDE(10) and Oracle(11g). Qualifier: I am not a dba ...
2
votes
2answers
169 views

Exposing ArcInfo level liscenses to ArcView desktops via ArcGIS Server and custom python script tool

I have a script that uses an ArcInfo level tool. The script works great on my machine but uses an ArcInfo level tool which the ArcView users don't have. Is exposing these ArcInfo level tools ...
1
vote
1answer
1k views

How to create multipart line and polygon with interior ring in ArcGIS Python?

My objective is to swap X,Y coordinates of feature classes using Python and arcgisscripting. Based on help examples, I managed to write script which reads and writes all geometry types. The problem ...
1
vote
1answer
3k views

ArcGIS Iterate Files tool in Model Builder

I want to use a "simple" iterator to process all the text files in a directory using my model but model builder won't let me connect the file to the first step of the model. Once I run the Iterate ...
2
votes
2answers
882 views

GDAL Clipping (hack)

I am trying to use the python script from http://www.sparkgeo.com/labs/2010/07/07/gdal-clipping-hack/ to clip a raster based on many shapefiles. The script is using a mysql database an i would like to ...
3
votes
4answers
8k views

Parse XML files in Python (ElementTree)

I am trying to parse some xml and rss feeds to extract some of their data in order to store it in a PostGIS database. The file I want to parse is here: ...
0
votes
1answer
661 views

Null output from field calculator code block

I have a simple calculation to compare two columns and populate a new column with the lower value but I am getting null output...any ideas? expression ...
0
votes
1answer
342 views

Generate a random 100x100 m bounding box in any projection in pure Python?

I'm given: Extend of WMS Layer SRS Now I want to, in standard 2.6 Python (no OGR or C lib dependencies), to generate a 100x100m random bounding box within that extent (assuming it is more than ...
1
vote
1answer
708 views

Dynamic Text in ArcMap 10.0 and arcpy - getting user name in specific format

I need to put in a specific text into a text element. The initials of the user who built the map. With arcpy I am trying to set the text element with dynamic text. If I put <dyn ...
6
votes
4answers
5k views

Field Calculation - Python - If/Then over multiple data columns

I have some VB code saved that looks at two columns of data, and populates a third with the low value. Pre-logic Script Code: Dim output as double if [MIN_LEFT] < [MIN_RIGHT] Then output = ...
6
votes
4answers
8k views

How do you test for a NULL string field in the Field Calculator with Python?

I am trying to perform an operation on a string field with a condition that it contains data. Referencing None with Python does not appear to work when the field is nullable and contains <Null> ...
1
vote
0answers
390 views

How do you convert a bounding box into the canvas CRS?

I need to convert the pixel coordinates of a bounding box to the same CRS being used by an existing layer. Here's the relevant code so far: # First, get the layer-coords version of the bounding box: ...
0
votes
1answer
356 views

Error when using .isalnum in ArcGIS fieldcalculator

ArcGIS keeps throwing an error when I use the following script in the field calculator, using Python: pre-logic script code: y= () if !fieldx!.isalnum(): y= 1 else: y= 0 Fieldy= y The ...
4
votes
1answer
527 views

Can you use arcpy.RasterToNumPyArray() to Graph a Raster with matplotlib?

Can you use arcpy.RasterToNumPyArray() to Graph a Raster with matplotlib? I'm looking to graph a raster with X, Y, and Z values in a 3D bar graph. I just can't seem to translate the numpy array to ...
6
votes
2answers
2k views

Segment road network line shapefile into new equal length segments line shapefile

I would like to subdivide a road network for an entire state into segments of equal length. So, Highway X would be divided into 0.5 mile segments, with a record for each segment, and Highway Y would ...
6
votes
2answers
1k views

Creating geodatabase from CSV using python

I have a file with weather data (daily) for multiple weather stations for multiple years. I am looking for some python script to automate the database creation process and its interpolation on a daily ...
6
votes
1answer
384 views

Is there a GeoDjango tutorial for GeoRSSFeeds?

I'm going through GeoDjango basics right now. Ideally, I'd like to publish a GeoRSS from a set of data I have that is already in Django's database. I know how to get a regular Feed working, but when I ...
2
votes
2answers
2k views

Help with ArcGIS10 Python and SearchCursor reading Null values in field

I'm using a Phython script to count the number of unique string values in a feature class. My script works if there are values in the field but if there are any NUll values in the field it crashes. ...
0
votes
0answers
150 views

How to enable user to specify field mappings from a table joined to a feature class?

I have a feature class and a new table every few days. I need to have the table's attributes added to the feature class based on a join. What would be a good interface in ArcMap to let the user map ...