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

learn more… | top users | synonyms

5
votes
2answers
221 views

Field calculator script to work out first 5 dominant area fields?

I have 5 fields of different landcover types with areas of each and found below: > PRC_Water| PRC_Bare| PRC_Urban| PRC_LVeg| PRC_LVeg| > 5 20 40 20 15 I have ...
5
votes
4answers
2k views

Spatial Query from PyQGIS?

Is it possible to reach the Spatial Query plugin functionality in QGIS from a Python script (PyQGIS)? If so, how do I accomplish this? Haven't found any documentation for it, even in the C++ API ...
3
votes
1answer
2k views

How to load a NetCDF-file into QGIS using Python?

I have a CF-conform NetCDF-file which can be loaded into Quantum GIS (Version 1.8) by using the "Add Raster Layer"-button and subsequently choosing the file and the raster layers of interest. This ...
3
votes
2answers
5k views

Reading National Elevation Dataset (ArcGrid/GridFloat/IMG) with python only tools

I've found high precision elevation (1/3 - 1/9 arcsecond resolution) data from the National Elevation Dataset provided by the USGS. It comes int IMG, Arcgrid, and GridFloat formats. I know ArcGrid ...
3
votes
1answer
408 views

Small script crashes Python

I'm running a rather simple script with ArcPy, which extracts values of raster to points of a shapefile: def raster_overlay(input_files): for raster in input_files: in_shp = ...
2
votes
0answers
77 views

Convert absolute file path to raster databaset [closed]

I wrote a simple python script that outputs an absolute path as string to a GeoTiff file. So this file can be treated as Raster. In a Model, the GeoTiff file is to be the input raster of a CopyRaster ...
2
votes
2answers
382 views

Trying to use Python code and user defined inline parameters to build a SQL expression

I am trying to build a tool where the end user can run a model and make a selection from a feature class based on 3 different fields, calculate the total shape length, & export the results to a ...
3
votes
1answer
697 views

Error when using gdal/ogr and python to clip a “shp” file by a “shp”

I am new to the gdal/ogr library for python and I was wondering how to clip a shp file by another shp file. I think I am having trouble with the syntax. Thanks - Stefan I keep getting a windows error ...
0
votes
1answer
144 views

Python geoprocessing performance [closed]

I'm using ArcGIS Server 10.0. I have a python geoprocessing that takes a lot of time. The geoprocessing calculates geometries using points, polygons, buffers, and cursors. I'm also using sql queries ...
1
vote
1answer
108 views

How to reopen a plugin-window in QGIS?

I am currently taking my first steps in playing around with programming a plugin in python 2.7 for QGIS 1.8. While my plugin does what it should, I would like to make it more userfriendly. At the ...
1
vote
1answer
374 views

Problem loading PyQGIS

There is a problem on my system when starting QGIS. I get this error. I am running openSuse Tumbleweed 64bit and openSuse 12.3 64bit. Same problem on both systems. Couldn't load PyQGIS. Python ...
2
votes
1answer
67 views

Multiple Selections from one shapefile

I have two shapfiles, Country and Blocks. I need to run a very basic selection to find out what blocks intersect the country shpe. But, the country shape has 250+ countries and I need to do this for ...
1
vote
1answer
355 views

OGR: How to save layer from AttributeFilter to a shape filter?

I select a subset of features from my shape file like so: node_lyr = nodes.GetLayer() q_str = "%s = %i" % (field, value) node_lyr.SetAttributeFilter(q_str) What is the best way to make a shape file ...
3
votes
1answer
200 views

How can I make my python script results appear in model builder

I have a model (model builder) and within I added a python script to calculate a field. My problem now is, that I don't know how to make the output appear in my model as it is the same as the input ...
1
vote
0answers
197 views

Reference to Basemap instance's coordinate system

I use the matplotlib basemap toolkit (mpl_basemap.Basemap) to plot GeoTIFF images on a map background using pcolor() or pcolormesh(). For this purpose, I need to transform a meshgrid of x and y ...
2
votes
1answer
117 views

Is it possible to destroy a spatial index?

QGIS 1.9 Is it possible to destroy a spatial index? I am noticing that if I generate a spatial index on a set of polylines (within a plugin), split one of the lines, and then recreate the spatial ...
0
votes
1answer
163 views

How to resolve encoding errors in python geoprocessing?

I have a simple python script that reads a string from a text file and inserts it into an Oracle database. When I run the script with Eclipse using Pydev plugin I get no error and the message is ...
4
votes
1answer
1k views

Compare fields of two tables and calculate field

Can you help me to compare fields in two tables? I have two tables, which contain ID and Measure fields. I need to take stroke by stroke values from field1(table1) and find all values in ...
12
votes
3answers
6k views

How to list feature classes with active “attribute domains”?

I have an Esri file geodatabase with attribute domains defined. I need to delete some of the attribute domains but can't because "The domain is used by an attribute rule.". How might I discover which ...
2
votes
1answer
878 views

How to import sextante(processing) for QGIS 1.9 (2.0)

In the current QGIS development snapshot the SEXTANTE toolbox has been merged into QGIS and is now known as "processing". This is a good step, but the previous import command doesn't work anymore. ...
1
vote
1answer
388 views

Problem with encoding UTF8 chars in Windows with pyQGIS

I have the problem to show characters (äöü) in a utf8 format in Windows. In Linux there is no problem and everything is displayed correctly. I use at the second line: # -*- coding: utf-8 -*- and ...
1
vote
1answer
825 views

List Map Services and Publish/Delete Map Services using Python in ArcGIS 10.1

I looked at the link http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000004s000000 which describes listing of map service for 9.3, how can we do this in 10.1, moreover I am trying to ...
2
votes
1answer
70 views

arcgisscripting in CGI script

I'm trying to write a Python script that imports arcgisscripting (stuck on 9.3.1 here) which is then run as CGI by a web app. It runs fine from the Windows command line but as soon as I drop it into ...
7
votes
2answers
2k views

Convert timeseries stack of GTiff raster to single NetCDF

Moving from gdal-dev mailing list: On Mon, Sep 2, 2013 at 7:09 PM, David Shean wrote: Hi list, I'm trying to package a timeseries of GTiff rasters with identical projection/extent/resolution as a ...
5
votes
3answers
1k views

How to repair paths of an unmanaged raster catalog in file GDB?

I'm using ArcGIS 9.3.1 and I have an unmanaged file geodatabase with raster catalogs in it. Tiles are loaded inside the catalog and each tile has a "Full Path" property which is environment specific. ...
5
votes
2answers
658 views

How to perform Intersection using ModelBuilder iteration?

I would like to take the intersection of two areas (one randomly generated), and do this n times. I can do it and get one result, but I can't save all the intersection areas to a file at the end. ...
4
votes
1answer
351 views

Scheduled Task - calling python through BAT

I'm using ArcGIS 10.1 and setting up some scheduled tasks to run on our server. I am calling a python script in a .bat file. When it runs, the connection to our SDE database is "invalid" or do not ...
3
votes
1answer
165 views

How to set waste water gravitational flow direction using DEM automatically?

I have a Geometric Network of Waste Water and I need to set line digitize direction according to the gravitational flow direction using a DEM. I'm trying to avoid flipping manually 1000 Km of ...
8
votes
1answer
305 views

Python with GDAL and PostGIS as a replacement of ArcGIS

Few times ago, I worked with daily land surface temperature satellite images of an area with the size of Alaska. I had to process around one thousand images. I downloaded them, mosaiced, projected, ...
1
vote
1answer
146 views

Running a QC check for gaps between vertices on a polyline

I'm checking polylines to make sure power pylons were correctly extracted from imagery. Is there a way to find all of the gaps or missed pylons in the database? Currently, I'm manually making a ...
1
vote
0answers
39 views

Need to Export 60 pdfF files from each MXD in ArcGIS 10.1? [duplicate]

I need to export 60 PDFs files so I am thinking if there is a way around to export 60 without having to open each MXD file at a time ? I am using ArcGIS 10.1 SP1 Build 3143 . Thank you !
0
votes
2answers
154 views

Python ogr: why is GetFeatureCount() so slow?

I did some profiling for a program I wrote and discovered that ogr's layer.GetFeatureCount() is significantly slower than just using python's BIF len(). Here are my test results def test(): ...
1
vote
1answer
143 views

How to iterate through maps & add new layer to data frame and legend of each using ArcPy?

Newbie for Python and wondering if the following is doable. Problem is like this: I have two sets of data: one mxd file for each of multiple cities (all stored in the same folder) containing ...
3
votes
1answer
219 views

Get features in order they are selected using QGIS

Is there a way of establishing the order that a user selected features using QGIS and Python? By example: we have a network of line features representing a road network, and the user defines a route ...
3
votes
1answer
462 views

How to get spatial reference of a shapefile using python?

I always use arcpy.GetParameterAsText to get the spatial reference from the user. There should be a way to decide what is the spatial reference of a shapefile but I can't find it. Something like ...
1
vote
3answers
305 views

Python: best practise to ceate a large shapefile

What is the best approach to create a create a very large shapefile (close to the max of 2GB) using python? Best approach means: robust and fast. Above all fast.
3
votes
0answers
86 views

Is it possible to access individual pages within an existing pdf using arcpy.mapping?

I've used the arcpy.mapping module for some time now to create mapbooks and other pdf documents, using a combination of Data Driven Pages and Python. I would like to take an existing pdf and save each ...
3
votes
1answer
129 views

Join is deleting fields in arcpy

I'm working on a script to automate the conversion of CAD .dwgs of rooms to feature classes, I'm nearing completion and am now working on the second portion of the script (I've seperated it into two ...
1
vote
1answer
249 views

OGR: How to best use GetFeature on a selection?

I think the following is very confusing sel_str = "ND_14 = '108'" l.SetAttributeFilter(sel_str) l.GetFeatureCount() >>> 1 In a for-loop this gives me for f in l: g = ...
1
vote
0answers
187 views

How to use the QgsMapToolIdentify in PyQgis?

I'm trying to implement the QgsMapTollIdentify class in a stand alone app but I can not. I am a newbie in Pyqgis and would like to ask how do I implement this class in Python? Thanks! Completing, ...
14
votes
6answers
3k views

Pure Python Library for Geometry Operations

Does anyone know of a pure Python (no C or Java dependencies) library for doing geometry operations such as buffer, union, intersects, etc? I'm looking for something that Google AppEngine compatible. ...
53
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
2answers
423 views

How to add a dynamic timeline to the QGIS canvas?

I am using the plugin Timemanager which works really great but there is one thing I'd like to improve. Instead of displaying the date and time on each frame, I would like to display a timeline ...
1
vote
0answers
69 views

Qgis 1.9 commitChanges() and Redraw a temporary layer

Using QGIS 1.9 and writing a python plugin. I have a function that connects points into polylines and draws them as a temporary, in memory layer. Membership in a polyline is determined by a field in ...
3
votes
1answer
1k views

How to create a QGIS Action which loads a raster?

I am following an article here:Actions HowTo , specifically the piece about an action to load a raster: Python type Add Raster Layer ...
1
vote
0answers
268 views

Calculating the closest distance between two points in ArcMap 10.2

I am looking for a script to calculate the closest meter to a set of addresses. I have a feature class of meters and a feature class of addresses. I have populated the address with fields for ...
3
votes
2answers
752 views

Script or model to create random points having multiple minimum distances within a polygon

Given: A single part polygon, total number of points to place inside that polygon, and table specifying the size of each subset (number of subsets n >= 1) of that total number of points and each ...
4
votes
2answers
860 views

TopoJSON: how to calculate scale and translate?

Context: I'm using the topojson file format along with d3. Since I could not find a library in Python that handles this format, I'm writing one. I've got the topojson to other formats working. ...
0
votes
1answer
151 views

Find the next vertices at the intersect line

I'm Trying to calculate the angle between two intersected lines at geometric network (simple edge)in order to check if the lines are close to be perpendicular. I already have an Array of the ...
3
votes
0answers
223 views

How to create a Typographic Map with Mapnik

So i am trying to make a typographic map using mapnik. I want the street names along a particular street not to overlap, but I want an intersection between two streets to over lap. Currently some ...