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

learn more… | top users | synonyms

13
votes
1answer
1k views

Voronoi polygons that run out to infinity

I have been working on implementing the voronoi.py script (Bill Simon's translation of Steve Fortune's code). According to the QGIS link it is basically the same code that I am working with, but the ...
13
votes
1answer
378 views

Creating nanoscale DEM with GDAL

A bit of a strange question perhaps, but let me give you a breif explanation of the background before my actual questions: Atomic force microscopy (AFM) is a method that, in short (and to my limited ...
13
votes
1answer
610 views

How can I utilize NumPy arrays to optimize big data geoprocessing?

I'm interested in learning how to utilize NumPy arrays to optimize geoprocessing. Much of my work involves "big data", where geoprocessing often takes days to accomplish certain tasks. Needless to ...
12
votes
5answers
5k views

How to get the extent of each polygon in a shapefile?

In arcgis 10 and python I want to get the extent (xmax, ymax, xmin, ymin) info of each of the polygons in a shape file. I can get the extent of the whole shape file using ...
12
votes
5answers
415 views

Smallest GIS library for embedded devices?

I need to use very simple geometry operations (read SHP or other standard format and simple searches) within an embedded device running a simple linux based os. What is the smallest and simplest API ...
12
votes
5answers
2k views

How can I programmatically get the path of “Python.exe” used by ArcMap

I am working with an add-in of ArcMap in c#. From c# code, i have executed some python scripts. Now, to run those script, I have hard-coded python path. But this is not portable. So, I want to get the ...
12
votes
3answers
8k views

Will ArcGIS 10 support Python 2.7 or Python 3.1?

I'm curious to know whether ArcGIS 10 will support newer versions of Python than 2.6. And for that matter newer versions of NumPy (ie, 1.4, 1.5 etc). I'm sure that this documentation is on the ESRI ...
12
votes
4answers
448 views

Mirror of Michigan State University's Python geoprocessing course materials

Been learning geoprocessing with Python using MSU's GEOG 825 ( python geoprocessing ) course. Unfortunately the link is dead now. I know this is a long shot but does anybody have a copy of the ...
12
votes
6answers
3k views

What tools in Python are available for doing great circle distance + line creation?

I need to use Python to create a great circle distance -- both a number, and preferably some kind of 'curve' that I can use to draw in a client-side map. I don't care about the format of the curve -- ...
12
votes
2answers
258 views

File organization for sharing ArcGIS python code

What is the best organizational structure for sharing ArcGIS python code and geoprocessing tools? Or even, are sharing code and sharing tools separate questions? Esri has a Methods for distributing ...
12
votes
2answers
350 views

Measuring Script Writing Competency

I've been asked by my manager to come up with some sort of competency measure for an employees understanding of scripting/programming. Because I am a self taught programmer, I really don't have a ...
12
votes
2answers
1k views

Multiprocessing Errors - ArcGIS implementation

I was wondering if anyone else in the community here has attempted to use multi-processing for spatial analyses. Namely I am trying to iterate through a series of rasters, create a multiprocessing job ...
12
votes
4answers
3k views

Clustering Trajectories (GPS data of (x,y) points) and Mining the data

I've got 2 questions on analyzing a GPS dataset. 1) Extracting trajectories I have a huge database of recorded GPS coordinates of the form (latitude, longitude, date-time). According to date-time ...
12
votes
2answers
2k views

SP1 for ArcGIS 10.1 has extension for 64-bit Python for background geoprocessing — implications for other Python use

If the 64-bit Background Geoprocessing for ArcGIS Desktop 10.1sp1 is installed how does that affect Python configuration for general use? Esri has released SP1 for the ArcGIS 10.1 product, and for ...
12
votes
2answers
296 views

Arcpy adds erroneous interior ring when writing adjacent, multipart geometry

I've run into an odd issue when using Arcpy to write multipart geometry to a shapefile. I am using an InserCursor to create a multipart feature from a list of parts each with a list of vertex pairs. I ...
11
votes
4answers
529 views

Is there Python library (other than ArcPy) for geoprocessing such as buffer?

Excluding ArcPy, is there any python library which can do geoprocessing, such as buffer/intersect, with shapefiles?
11
votes
3answers
2k 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 ...
11
votes
4answers
7k views

Is it possible to use Arcpy in ArcGIS 10 to zoom to a selected feature?

The answer to this may be a simple yes or no, but I'm hoping that someone is aware of a way to zoom to the extent of a selected feature using the ArcPy modules in ArcGIS 10.
11
votes
3answers
6k views

list all feature classes in GDB, including within feature datasets

From python how can I build a list of all feature classes in a geodatabase, including inside feature datasets? The standard example only lists FC's at the top level of the gdb: import ...
11
votes
3answers
564 views

Industry-based examples of using Python in geoprocessing and arcpy

I was asked recently by some students what types of operations GIS Analyst/Developer are usually trying to automate by using Python with geoprocessing in ArcGIS and ArcPy site package. I guess it ...
11
votes
4answers
2k views

Is there a Python Lib for requesting WMS/WFS and saving as image/PDF?

i am wondering whether there's Python open-source GIS lib which has APIs to support call WMS/WFS from another GIS server (e.g., GeoServer) and then save the response data(WMS Basemap and WFS layer) as ...
11
votes
3answers
3k views

Clipping raster with vector layer using GDAL

I have installed GDAL using the Osgeo installer. How can I clip a raster layer with a vector layer programmatically? Is there any GDAL API available which can help me with this? I am using Python.
11
votes
6answers
883 views

How to implement value-by-alpha map in GIS?

I've been doing some background reading about cartograms recently and stumbled upon interesting alternative - value-by-alpha maps. Concept is described in more details here and full paper is ...
11
votes
1answer
2k views

How do I get the pixel value of a GDAL raster under an OGR point without NumPy?

I am working on a computational model of the abundance of wild pollinators across a landscape. The model itself is complete, and I am now struggling with a post-processing step. I have my GDAL ...
11
votes
4answers
2k views

How to manually break statement execution in python console of ArcMap

How does one break the execution of a long-running process in the python console of ArcMap? For example, how do you break a long iteration like the one below once it is started? for i in range(1, ...
11
votes
1answer
320 views

File Validation using ArcPy

I have a script which scans a directory and outputs basic raster data information such as the file name, format, number of bands, and etc. I need a way to make it so if the directory does not contain ...
11
votes
1answer
236 views

How to use GDAL with PyPy?

I am trying to optimize my python code using pypy. While I am able to import most libraries and run succesfully, I am not able to import GDAL libraries. The same libraries when imported in Python 2.7 ...
11
votes
1answer
289 views

Python increasing the filesize of my .mxd

I have a geoprocessing script that runs the following.. arcpy.AddMessage("TEST...") Yes just one line of code. A blank .mxd starts at 391kb for me as I run my script and save the filesize ...
11
votes
1answer
733 views

How can I display raised error messages to the user in the ArcGIS geoprocessing results window?

Question: Can print statemnts raised from a custom exception be displayed in the gp results window? Background: I modified a script that I found that takes two inputs from a user, finds the ...
11
votes
3answers
2k views

Is there a way to use “Select by Attribute” in QGIS using a python command?

is there a way to use the function "Select by Attribute" in QGIS using a python command? In my plugin the user should enter a value via a GUI and this value should be used in a function which selects ...
11
votes
1answer
393 views

Teaching Python to Land Surveyors

Does anyone have any good examples of using Python to automate or simplify common surveying tasks? I'm teaching a Python/ArcPy lab this week for a GIS class. There are a number of surveying ...
11
votes
2answers
173 views

How could I rate roads for scenic drives?

relative GIS newbie here. I've been working on a personal project to rate roads on how nice a ride they'd be on a motorcycle. I wrote a Python program to work through road data in the TIGER dataset ...
11
votes
1answer
481 views

automating roof orientation detection from satellite imagery

A while ago I did a neighbourhood roof orientation survey for solar panel deployment, by visually checking each roof and marking individually whether they were south or almost south-facing. As this ...
10
votes
6answers
464 views

How do I iterate through every cell in a continuous raster?

See this link for more details. The Problem: I want to loop through a continuous raster (one that has no attribute table), cell by cell, and get the value of the cell. I want to take those values ...
10
votes
2answers
9k views

How do I add a shapefile in ArcGIS via Python?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shape file to the current map. (And then do stuff to it, but that's ...
10
votes
3answers
496 views

How to download and process raster files in Python?

I am fairly new to python and seek guidance for a question which might sound trivial to many. Is there a way to use 'wget' in a python script to download raster files from a server and process them ...
10
votes
3answers
1k views

Looking for a pythonic way to calculate the length of a WKT linestring

I was quite unsatisfied with Calculating Length of Linestrings in WGS84 in Miles. It kept me wondering if there is a more convenient, Pythonic way to calculate the length of a WKT linestring according ...
10
votes
2answers
3k views

Point (of a linestring) within Polygon using ogr and Python

I'm currently working on a project in which I need to build a topological network out of the geometry features I find in shapefiles. So far using Ben Reilly's open source project I've managed to ...
10
votes
2answers
819 views

How to compute a new attribute based on changes in another attribute?

I am attempting to classify a set of gps time-encoded point data into behaviors based on different attributes. I have created an attribute that is 0 for home and 1 for away based on location, and now ...
10
votes
3answers
225 views

How to convert LAS file to numpy array?

I have begun learning how to manipulate LAS data in python and wanted to see how others handle LAS files. I would like to read the points (I am using a numpy array), and filter out classes 1 and 2 ...
10
votes
4answers
846 views

Best method to re-compile a Python Addin after editing script?

I have been developing a few python addins and I'm just wondering what is the best way to re-compile the addin anytime I edit the script. Currently, if I make an edit to the script, it seems like I ...
10
votes
2answers
1k views

How do you delete an in-memory Table View?

In a Python script, I'm cycling through thousands of Excel files and using arcpy.MakeTableView to create in memory table views from the first spreadhseet in each file. How do you delete the reference ...
10
votes
2answers
229 views

Count raster value in a bounding box (spatial extent)

I have simple question: given a bounding box, how can I count the number of specific values (say, I am interested in the number of value == 1 ) in a raster in 1) arcpy, or 2) raster package in R?
10
votes
2answers
1k views

How to split shapefile per feature in Python using GDAL?

is it possible to split a shapefile per feature in python? (best would be a solution where i can temporarily save the resulting vector objects to the memory instead to disk). The reason: I want to ...
10
votes
1answer
1k 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 ...
10
votes
1answer
656 views

How to copy geodatabase on ftp site to local geodatabase using Python?

There is a geodatabase sitting on an ftp site that I would like to download with a Python script. Right now I'm thinking one way to do this is to copy the ftp geodatabase to a geodatabase on my ...
10
votes
1answer
460 views

How to visualize azimuthal data with uncertainties?

I am trying to make a figure showing azimuthal data with a different range of uncertainties at each point. This oldschool figure from a 1991 paper captures the "bowtie plot" idea that I'm aiming for: ...
10
votes
3answers
2k views

How to find and merge duplicate points?

I have two point shapefiles: Red and Blue. Each point shapefile has a z value which represents a radius (i.e. represented as buffers in the example). A duplicate point is defined as a point that ...
10
votes
3answers
885 views

Efficiently finding the 1st order neighbors of 200k polygons

For every one of the 208,781 Census block groups, I'd like to retrieve the FIPS IDs of all of its 1st order neighbors. I have all the TIGER boundaries downloaded and merged into a single 1GB ...
10
votes
2answers
984 views

Gdal Dataset.ReadAsArray() crashes Python

I am using Python 2.6.5 (32bit) with Numpy 1.3 and Gdal 1.9.1 installed on Windows 7 64bit. I am trying to read an 800 MB Imagine (.img) raster dataset into a Numpy array to do some raster algebra, ...