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

learn more… | top users | synonyms

10
votes
2answers
2k 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
788 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
544 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
2answers
4k views

How to export only certain columns to a CSV file in ArcGIS?

I've written a python script using arcpy which outputs a polygon feature class into a File Geodatabase. I have added a function to export the attributes to a separate CSV file. I am using the code ...
10
votes
1answer
796 views

Is it possible to take automatically a “screenshot” of my selected feature in QGIS using Python?

I am implementing a tool which allows the user to create a profile of a feature (in my case urban parcels). Is it possible to automatically take a screenshot of this feature (displayed in a QGIS ...
10
votes
3answers
3k 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
976 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
1answer
873 views

Is there a way to access QGIS plugins in Python?

Is there a way to access QGIS plugins in Python? I'd like to write a script to do some geoprocessing, and I'd like to use the clip, regular points and convex hull tools in fTools, as well as the Road ...
10
votes
2answers
1k views

What software to use for making digital elevation models from UAV aerial imagery?

I have a an unmanned aerial vehicle (UAV, also called a drone) and would like to use it to create a digital elevation model and orthomosaic over a smaller area (10 km2). My platform will be able to ...
10
votes
4answers
2k views

Programatically split a polygon with a line

In looking at this question, it occurred to me that I am not sure how one would go about using geoprocessing tools in ArcGIS to split a polygon with a line programatically. Manually, you would use ...
10
votes
2answers
265 views

Aggregating Polygons To Meet Privacy Requirements

I have a point feature class representing office locations of all employers in a certain industry. The feature class has an attribute for storing the number of employees working at each office. ...
10
votes
1answer
1k views

How to find differences between shapefiles?

Every month I have to QA/QC some streets data for an entire county (over 47,000 records). The first step is to compare the two files. Currently, I'm using a tool that was created in house via VBA ...
10
votes
3answers
1k 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, ...
10
votes
1answer
409 views

OGR/GDAL threading results in low core utilization

I'm trying to process some raster data using ogr/gdal and I can't seem to get full utilization of all the cores on my machine. When I only run the process on a single core, I get 100% utilization of ...
10
votes
4answers
2k views

ArcGIS 10.0 Python SearchCursor file locking

I have a script that gets a value from a shapefile's field to return to the user. It seems that only when the arcpy.SearchCursor is called ArcMap locks the file and it doesn't get removed after the ...
10
votes
2answers
290 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 ...
10
votes
2answers
735 views

Metadata -auto build using python

We have a large (10,000 plus) repository of spatial data (shp/gdb/tab vectors and ecw/tif rasters and also las, xyz and DEM data) where some have metadata records in xml using anzlic metadata editor. ...
10
votes
1answer
1k views

Exit script with Python

I've got a Python script for ArcGIS that I'm working on, and I'd like to have the ability to have the script quit if it doesn't have the necessary data available. I tried a straight up sys.exit() but ...
10
votes
1answer
322 views

PyQGIS file lock release

I was wondering what triggers the release of file locks in pyQGIS? I am trying to delete a few data sources (used temporarily) by calling QgsVectorFileWriter.deleteShapeFile, but I have to quit QGIS ...
9
votes
5answers
1k views

Recommended programming language for remote sensing?

I am beginning studies that hopefully will lead to a long career as a remote sensing specialist. I am currently working with ArcGIS for some applications and learning ENVI for others. I have ...
9
votes
4answers
3k views

How to develop GUI in Python for geoprocessing?

I want to develop GUI in Python for geoprocessing, but I don't know what is the best GUI tool or library (Tkinter, PyQT, wxPython) for geoprocessing? Can I use PyQT for GUI programming in ArcGIS?
9
votes
2answers
7k views

Converting projected geoTiff to WGS84 with GDAL and Python

Apologies if the following question is somewhat stupid, but I am only VERY new to this whole GIS thing. I am trying to convert some projected geoTiff images to WGS84 using gdal in python. I have ...
9
votes
7answers
5k views

How to get raster image as array in Python with ArcGIS

When starting to work with Python and ArcGIS 9.3, I assumed there would be a simple way to get a raster image into a Python array so that I can manipulate it before storing it back as another raster ...
9
votes
2answers
2k 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 ...
9
votes
5answers
3k views

Compiling Python Scripts that use ArcGIS Geoprocessing Tools?

I've been coding with Python for several months now and have developed some reasonably complex scripts for primarily geoprocessing tasks. That being said, I'm still learning a lot as I'm coming from a ...
9
votes
2answers
1k views

Why is this simple arcpy script so painfully slow?

I have a simple arcpy script to update a field in a point shapefile with info from the polygon feature that it is within. It takes 9 minutes to do 100 points in arcpy but a spatial join in arcmap is ...
9
votes
3answers
8k views

How to create a shapefile in ArcGIS 10 using arcpy?

How can I create a shapefile using Python in ArcGIS 10? I have lat & long. From this I need Python code which will create a shapefile and display it in ArcGIS 10. Thanks.
9
votes
6answers
5k views

ArcGIS/ArcPy Python, how to get latitude and longitude of a projected point?

I have a point feature in a feature class that is being accessed by ArcPy. The point is projected but I need to find an efficient means to get the unprojected latitude and longitude for this point. ...
9
votes
5answers
388 views

How to improve performance when using ArcGIS cursors in Python with big tables?

I have a pretty big point feature class in a file geodatabase (~4 000 000 records). This is a regular grid of points with a 100m resolution. I need to perform a kind of generalization on this layer. ...
9
votes
2answers
3k views

How to get list of selected features in ArcGIS for Desktop using Python code?

I have a question regarding selections in ArcGIS for Desktop. Assumed I have one layer in ArcMap and I have selected two of five features. Is it possible to get a list of all selected features by ...
9
votes
2answers
4k views

How to list feature classes in multiple geodatabases in a folder?

I have a folder with numerous geodatabases in it. Within the geodatabases are feature classes. I would like to get a list of the feature classes in these geodatabases using a Python script. I've only ...
9
votes
4answers
1k views

How to buffer in pyQGIS?

I'm looking for some examples to do simple python scripts in QGIS. How would I do a buffer analysis on a dataset? I can't seem to find much in the manual and QGIS python that quite matches the Esri ...
9
votes
3answers
3k views

Get all vertices of a polygon using OGR and Python

I'm having a little trouble with the Python OGR API. What I am trying to do is get all the coordinates of each vertex of the outer ring of a polygon. This is what I have so far: import osgeo.ogr ...
9
votes
6answers
401 views

How to programmatically check if the number of shapes = number of table records?

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to ...
9
votes
2answers
1k views

Speeding up my Python calculated field

I am new to Python and have started to create scripts for ArcGIS workflows. I am wondering how I can speed up my code to generate an "Hours" double numeric field from a timestamp field. I start with ...
9
votes
4answers
508 views

How to use PostGIS to handle complex geoprocessing workflows?

Our organization is considering moving our geoprocessing workflow to PostGIS. We are currently using ArcGIS, with a plethora of custom Python tools used in ModelBuilder. We're moving most of our data ...
9
votes
4answers
6k views

using shapely: translating between Polygons and MultiPolygons

[EDIT: the solution to this was simply to use OGR to read shapefiles. See geographika's example.] In an ESRI shapefile, there is no distinction between Polygons and MultiPolygons. Furthermore, there ...
9
votes
3answers
7k views

How to change feature class and field aliases in bulk?

I have over a hundred FCs, each with 10 or 20 attributes to add or change the aliases for, two or more times a year. Needless to say, this is not something I'm going to grunt my way through. How can I ...
9
votes
3answers
2k views

How to programatically check for a mouse click in QGIS

I want to know how to check for a mouse click in QGIS. I am trying to write a python plugin and want to provide functionality similar to the "Select Single Feature" tool that already exists in QGIS. ...
9
votes
2answers
2k views

Is it possible to get the EPSG value from an OSR SpatialReference class using the OGR Python API?

When reading a layer from a OGR PostGIS connection I can get the SpatialReference of the layer, but is it possible to get the EPSG value? Is there any documentation on this? For example: lyr = ...
9
votes
4answers
4k views

How to Batch Clip in ArcGIS Desktop 10 using Python/ArcPy?

I've come across a few similar questions for older versions of ArcGIS, but haven't found a suitable answer for ArcGIS 10. I have two polygon shapefiles that cover a large area (e.g. an entire ...
9
votes
5answers
1k views

How to convert line simple features to topological network?

using Gdal/ OGR is there a way to convert a shp, kml, or PostGIS line layer into a network of nodes and segments so it can be used in packages such as networkx?
9
votes
1answer
6k views

How to create a script tool that will create a copy of a feature class and offset it by a given distance? (arcpy)

I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. I asked if there was any way to do this last week, and I was informed that I ...
9
votes
1answer
477 views

Import GRASS and SAGA modules to python script

I'm new at this. I am "building" a python plugin for qgis and I want to import modules from GRASS and SAGA but I don't understand how to do it. The plugin I want to import is Kriging interpolation ...
9
votes
4answers
491 views

ArcView 3.x Avenue Bitmaps (Tabs?) vs. ArcView 10 Python Cursors

Note: While this question has an answer, any further tips for optimizing a cursor process would be greatly appreciated. I will be monitoring for any updates. Currently, my boss (who works in Avenue) ...
9
votes
2answers
2k views

Measuring distance in spherical Mercator vs zoned UTM

I've got points in WGS84 lat/long and I'd like to measure "small" (less than say 5km) distances between them. I can use the haversine formula from http://www.movable-type.co.uk/scripts/latlong.html ...
9
votes
2answers
634 views

Can ArcGIS and OSGeo4W share the same python install?

I don't like unnecessary duplication. Is it possible to install python only once and have both ArcGIS and OSGeo4W use it?
9
votes
5answers
267 views

Raster diff: how to check if images have identical values?

Is there a means to check to see if any 2 given raster layers have identical content? We have a problem on our corporate shared storage volume: it's now so big that it takes over 3 days to conduct a ...
9
votes
2answers
2k views

Error handling with python script in ArcGIS 10

I have a python script that I am using to create a list of all mxd files (with full pathing) in our Projects folder. The script then uses that to iterate through the list and do a ...
9
votes
2answers
4k views

How to make a button that calls a python script as a command rather than a script tool?(ArcMap 10)

I believe that in Arc9.3, commands could be created using VBA scripts. To add a custom command, you would navigate to Customize > Toolbars > Customize... and click UIControls. However, UIControls is ...