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

learn more… | top users | synonyms

7
votes
5answers
3k views

How to workaround large mosaic process which is failing?

I need to mosaic about 550Gb of tif imagery together and the software I have tried keeps failing. The area has been split into zones so that the smallest has approx 200 tiles. I have used the latest ...
11
votes
3answers
3k views

Exporting arcgis features with attachments, for outside ArcGIS

Arcgis 10 features the new ability to add attachments to individual features to feature classes stored in a geodatabase. One use of this would be to add multiple pictures to a specific location, fire ...
6
votes
2answers
1k views

Big Satellite Image Processing

Im trying to run Mort Canty's http://mcanty.homepage.t-online.de/ Python iMAD implementation on bitemporal RapidEye Multispectral images. Which basically calculates the canonical correlation for the ...
1
vote
1answer
806 views

The table was not found error - ArcGIS 9.3.1, Python

I have a python script that does the following on multiple tables maketableView - not shown in code Addjoin Copyrows MakeTableView it was working ok, until all of a sudden it stopped. Heres ...
3
votes
1answer
205 views

Problem with precision when convert from WKT to shapefile

I have a problem with converting from WKT to shapefile in pygdal. In wkt I have fields with precision (for example real 7.2). When I create a shapefile I have field numeric with no precision (numeric ...
6
votes
3answers
4k views

Splitting lines automatically at specific distances using ArcGIS Desktop?

I have a set of polylines which I need to split at varying distances from their starting points. In general, I'm looking for a something similar to the SPLIT function within the editor tool. There ...
2
votes
1answer
2k views

Exporting .jpg files from data driven pages in Arcmap

I have generated about 90 maps through data driven pages(ArcGIS 10.0). I now want to export them as .jpg files in either landscape or portrait format. I tried python but it is not working, it worked ...
3
votes
1answer
175 views

How to unload() a plugin in QGIS 1.7?

I am writing a python plugin for QGIS 1.7 (started it on QGIS 1.6 but switched to 1.7 recently). Since I switched to 1.7 my unload function doesn't seem to be working anymore. Whenever I implemented ...
3
votes
2answers
809 views

Python Widget Wrapper ArcGIS Viewer for Flex

I'd like to create a flex wrapper for python code run locally (utilizing arcgis data and outputting data that can be displayed on the flexviewer). I'd like to use gdal or pyproj modules to process ...
1
vote
2answers
793 views

How to automate relative filepath when adding a new toolbox to the arcmap catalog?

So I'm creating an arcpy script for a custom toolbox and I want to make it so that a user can essentially utilize the script in that toolbox without having to change the source path (which I made ...
5
votes
2answers
937 views

How to check if domain already exists?

I am trying to check the existence of domains in my file geodatabase which contains 4 domains (automatically populated after I created some annotation feature classes). My code is as follows: import ...
5
votes
3answers
2k views

Saving *.dbf as *.xls using Python?

i've been let loose in the workplace to learn python to do things in Arcmap10. so, i've learning python as i go and trying to remember the programming i have done. where i am in this project is ...
2
votes
2answers
806 views

Moving all shapefiles (SHP) in MXD to new File Geodatabase (*. gdb) using ArcGIS Desktop?

What I need to do is to move all the shapefiles in an mxd into a newly created gdb, checking prj, and update mxd reference. I have ArcGIS 10 SP4, license ArcView. I studied a bit of Python and get ...
3
votes
2answers
637 views

Adding VBA into a Python script generated by ModelBuilder

I have created a model that does a calculate field and have used VBA in the code block. But when I export it to Python, it doesn't work. Here is the VBA code: new_value = ...
1
vote
2answers
914 views

ArcGIS problem accessing fields attribute table

I encounter a strange problem. I have a simple shape file to which I added some fields and then populated them. Now I wanna access those fields from a script to run some buffer operations. I wanna ...
2
votes
2answers
3k views

GDAL: Convert specific RGB (GeoTIFF) color to transparent

I have an RGB GeoTIFF file and I want to convert a specific RGB colour to transparent. I would like to use GDAL for doing this, but external Python scripts are also an option (though I haven't learned ...
4
votes
2answers
2k views

Check if shapefiles exists in folder

In ArcGIS modelbuilder I want to check if a shapefiles exists, if not I want to create the shapefile in that folder. I guess the calculate value tool within ArcGIS modelbuilder can be used, but I need ...
2
votes
2answers
644 views

How to truncate file geodatabase tables with python?

Everything is in the title. I need to truncate file geodatabase tables (1 or all) with python. What is the code for that? Thank you in advance!
4
votes
3answers
2k views

arcpy join field tool is not licensed

I am using ArcGIS and arcpy to process some shapefiles. When I try to use the function arcpy.JoinField_management() the program stops and Python says that the tool is not licensed. This confuses ...
4
votes
1answer
538 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
608 views

How to translate ESRI cursor example to pyQgis?

For example, how to translate this code into pyqgis? rows = gp.UpdateCursor("D:/St_Johns/data.mdb/roads") row = rows.Next() while row: row.buffer_distance = row.road_type * 100 ...
36
votes
1answer
5k views

How to smooth the polygons in a contour map

Here is a contour map for which all the polygons of levels are available. Let ask how to smooth the polygons keeping all vertices preserved in their exact locations? Indeed the contour is made on ...
0
votes
5answers
1k views

How to copy a fgdb using Python?

I am trying to copy fgdb from one path to another using Python. copy(base.gdb,dest) And got the message: Error Info: [Errno 13] Permission denied: How to fix it?
1
vote
1answer
952 views

ArcGIS Python Script Tool Validation: Control Overwrite Behavior

I'm creating a script tool to read the USGS earthquake GeoRSS feeds. It works fine as a script with hardcoded values. The script also works fine as a tool for creating a new feature class for a given ...
2
votes
0answers
172 views

How to Auto Increment Attribute Based on Nearest Point? [closed]

An authority I am working with would like their Hydrants, a point shapefile, to be renumbered based on their location. I am looking for any python script that would help me A. Find the next closest ...
4
votes
1answer
343 views

How to move Layer to back?

from my Plugin I've loaded a rasterlayer using the following code: fileName = "/path/to/raster/file.tif" fileInfo = QFileInfo(fileName) baseName = fileInfo.baseName() rlayer = ...
2
votes
2answers
864 views

Having trouble getting specific items from a list. What am I doing wrong?

I am a total beginner when it comes to python. I received some help already getting this code started but I hit a wall. I have a directory with 200 folders, each with a geodatabase, feature dataset, ...
5
votes
2answers
3k views

ArcGIS 10 Python script to search directories and subdirectories for intersects and clip them

I'm trying to develop a tool that queries our company's data stores for any data that intersects a feature. So when we acquire a new property we can run this tool and it will find all of the data we ...
1
vote
1answer
514 views

Scipy: Convert RGB TIFF to grayscale TIFF and output it on Matplotlib

I want to manipulate RGB bands in a TIFF file and output the grayscale map on matplotlib. So far I have this code, but I couldn't get it on grayscale: import scipy as N import gdal import sys import ...
4
votes
2answers
2k views

Arcpy Insert Cursor not inserting all rows

Good morning all, I have a script here that takes data from a cross-tabulated non-spatial dataset where monthly values are stored in a single table row for a given year and linearizes those data so ...
1
vote
1answer
3k views

UnboundLocalError: local variable 'x' referenced before assignment

I am trying to execute this code, import osgeo.ogr def findPoints(geometry, results): for i in range(geometry.GetPointCount()): x,y,z = geometry.GetPoint(i) if results['north'] == ...
3
votes
1answer
1k views

How can I create an empty feature class in a file geodatabase based on the schema of an SDE feature class?

I have 150+ feature classes in SDE for which I need to create an empty feature class in a file geodatabase. For these feature classes I need to import the attributes and the name of the feature class ...
2
votes
1answer
147 views

Any reason NOT to convert to a single projection when loading GIS data?

I have been given the task of: Loading a list of properties with lat/long coordinates into a SQL Server 2008 database. Loading points and areas (polygons) of interest from a variety of shapefiles ...
5
votes
3answers
1k views

Using arcpy what is the most efficient way of projecting a selection from a large data set?

I have a large data set X(x1-xn) from which I must select consecutively the attributes A(a1-an) from X.fieldsSRC or X.fieldDST and project the selections. I have a functioning arcpy script that does ...
1
vote
0answers
409 views

how to create shape file table from text file in QGis python

I have a text file with all field information how can create new polygon shape file table with the text file.. text file having following content.. NAME LAYER GM_TYPE KML_FOLDER ID PERIMETER ...
1
vote
0answers
785 views

arcpy spatial join input parameter problems [closed]

Using ArcGIS 10 SP4 with all extensions... I have a parent directory (J:\...\spatialjoin) containing two sub-directories of feature classes I want to spatially join. Directory 1 (target features) ...
1
vote
1answer
166 views

can't generate/display signed float values using python/gdal

I'm trying to create a raster with signed float values as the pixel values and display the results in MapWindow on windows. What is the proper gdal band type to use? I've tried both gdal.GDT_Byte ...
1
vote
0answers
113 views

refactoring an XSLT processor with minor changes

having an extremely large xml-file - which is derived from the field of geo informatics. i got it from a German subsite or the OpenStreetMap-Project: the Geograpical-Engineering-site that deilvers a ...
2
votes
1answer
863 views

How to use SQLite db with QGIS plugin?

Hi I would like to use SQLite for storing some information in my plugin for QGIS. I have a problem: if I put the db let say test.db among the resources as file, after compilied the resorce.qrc file, ...
3
votes
1answer
568 views

Raster data array output flipped on x-axis using python/gdal?

I'm trying to create a raster using the python gdal libraries and I've gotten to the point where data is being output, but the output data is flipped on the origin point's x-axis. I know I must be ...
1
vote
1answer
483 views

ImportError: cannot import name QgsVectorFieldSymbolLayer

I am using QGIS 1.7.4., downloaded April 2012, but receive an import error loading the class QgsVectorFieldSymbolLayer. As i understand this class has been added in the Python bindings on 2011-11-15. ...
3
votes
1answer
845 views

Select Layer by Location Produces Empty Output in Python

I am new to using Python scripts to execute ArcGIS tools. In my first script I am attempting to loop through many Select Layer by Location operations on overlapping feature classes. I want to create a ...
1
vote
0answers
150 views

Polygon symmetry detection

I was wondering if there was any way to create main axis (axis of symmetry) lines for polygons. I have polygons that represents buildings. I will want to find main axes (axis of symmetry) for those ...
2
votes
2answers
1k views

Modelbuilder: Needing to input multiple featureclasses into merge tool

So I have 490 point fc's in a single directory with uniform spatial features, field names/datatypes. I'm trying to figure out how to consecutively input the first seven fc's into the merge tool, ...
1
vote
1answer
229 views

ArcPy: Creating weekly-sum layers by summing field values from seven consecutive daily .dbf's

So I have 490 consecutive daily rainfall shapefiles/.dbf files in a single directory. Each consists of a uniform even-spaced grid of 220 points having uniform pointIDs, number of records, field names ...
12
votes
1answer
1k views

How to get size of file geodatabase feature class on disk?

Is there a simple way to determine the amount of hard drive space a feature class takes up? I feel like I'm missing something simple, but I don't recall a method that does so. You would think that ...
0
votes
1answer
359 views

Python Field Calculation [duplicate]

Possible Duplicate: Iterative position within Field Calculator/Python I need to calculate a field for a data set that is grouped by county. At each change in county I need the column to ...
0
votes
1answer
614 views

Installing GCC correctly

I'm writing this as an utter Ubuntu newbie. I want to run the script found on Save points to a shapefile with GDAL. But I get the following error, yes this error is similar to the question posted ...
1
vote
1answer
1k views

How To Add Values to an Attribute Field Based on a Selection - Python

Alright another problem that I have. I am trying to give a priority ranking to lots based on various criteria. Basically I have 7 areas that are criteria, if lots overlap each other the criteria is ...
2
votes
1answer
193 views

Converting 2D shapefile to Equal Area Projection?

I have thousands of shapefiles with coordinates in lat/long (-180 to +180 x, -90 to +90 y), that contain polygons of which I wish to calculate the area. I'm using the Python GEOS/OGR/GDAL API. If I ...