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

learn more… | top users | synonyms

10
votes
2answers
800 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. ...
1
vote
1answer
274 views

Can I open a form in layer action?

I want to open a form (made in QTDesign) in the layer action. It is possible?
1
vote
2answers
415 views

ArcGIS 10.1: “ERROR 000223: Cannot extract event table properties” when iterating through multiple files/folder

I am trying to convert ~270k csv-files with lat/long-data to layerfiles. The files are split into folders by year, i.e. ~30 folders with ~9k csv-files in each. I have written a script to iterate ...
8
votes
1answer
577 views

How to address the new “Task-Completed” QgsMessageBar in Python?

I am really amazed what huge steps the QGIS development has taken in the last months. The new iconset, the improved Print composer and many more changes to be seen in QGIS 2.0 are really awesome! ...
0
votes
1answer
995 views

How to insert values from one table into another?

I am trying to write a script that iterates through each row of a table, calculates for this row something. The result of this calculation is finally stored in another table (with just one row). Now I ...
0
votes
0answers
18 views

QGis non blocking notifications with pyqgis [duplicate]

I'm searching for the way to use the new QGis non blocking notification system with the QGis python wrapper. I found informations on this fonctionnality but nothing on how to use this especially with ...
0
votes
1answer
251 views

arcpy.setValue for Condition from Dictionary

Hi: I am trying to create a function to update multiple fields based on different criteria. I want to pass the field name and condition thru' a dictionary (please see the function description in the ...
0
votes
0answers
29 views

using python and arcpy , how can I compute the direction and angle of a line segment? [duplicate]

if start_point_x < end_point_x and start_point_y > end_point_y: slope = ((end_point_y - start_point_y)/(end_point_x - start_point_x)) radian = math.atan(slope) degrees = ...
1
vote
0answers
433 views

Calculating the Centroid of polygon in modelbuilder (VBA to Python) [closed]

Got an easy one, that's got me stuck. I'm moving some models that were created in 9.3.1 to work in 10. Part of the model is calculating the X coordinate of a polygon to a specified field. The code ...
1
vote
1answer
202 views

Python GDAL: find out spikes and pits in DEM

I'm working with on a DEM (Geotiff) in Python GDAL, and I'd like to find out the spikes or pits in my terrain. I have no idea how to proceed, does anyone have good algorithm to help me out? Thanks, eo ...
2
votes
2answers
784 views

Field calculator or update cursor?

I have a feature class in which one field (let's call it "Field_A"), as yet empty, is to be populated by the contents of another field ("Field_B") multiplied by a certain number (I'll call it the ...
1
vote
1answer
154 views

Creating prepared geometries with OGR from Python

Is it possible to create a prepared geometry object using the Python SWIG geos.ogr module? It seems that Shapely and GeoDjango both have this functionality, but I can't see any mention of it in the ...
2
votes
1answer
169 views

Python script to update attributes crashing during loop

I have a script to update a field in one feature class from a selected record in another feature class. This is done through looping through records in one feature class selecting appropriate the ...
1
vote
0answers
115 views

Python GDAL/OGR: check lines geometries connectivity

I'm working with shapefiles representing roads, so basically it's stored as (poly)lines. I need to perform a road connectivity checking. In other words, I want to ensure that roads meant to ...
1
vote
1answer
858 views

Make Route with Python and network analyst in ArcGIS 10

Good Day, I'm having trouble debugging my python code to create a network analyst layer in ArcGIS 10.0. Basically when run from a script tool the code completes successfully without actually doing ...
2
votes
3answers
312 views

How to test if geometry is inside another?

I need to tell whether geometries from a shapefile are inside other geometries or not. For example, I want to test if there are trees (represented as points in trees.shp) inside the urban areas ...
0
votes
0answers
73 views

Congressional Redistricting

I have a project coming up where I need to create new congressional district looking at only total population data. I am planning on using the census tract level of data, but I am having some ...
0
votes
1answer
210 views

How to access the button on the form?

I have a form that appears when you start the plugin.How do I properly apply to the button on the form, so that when you click on the button performed "function". import sys,os import win32api from ...
1
vote
1answer
964 views

How to set Marker Line symbol for QgsVectorLayer by using Python?

QgsVectorLayer Right click->Properties->Style->Single symbol->click on simple line in tree node ->symbol layer type -> Marker line Kindly help me to set marker line symbol programmatically by using ...
0
votes
0answers
50 views

How specify a corridor minwidth?

I’m trying to make a corridor between two substations with ArcGIS, a macro corridor and a micro corridor. I have two questions in this respect and would be grateful for your suggestions. a) How can ...
6
votes
3answers
3k views

How to efficiently read and reclassify many rasters in R

I've been tasked to create a suitability analysis of wave conditions in the Gulf of Mexico. I have 2 thousand or so raster files that are about 8 MB each (2438 columns, 1749 rows, 1km cell size). ...
1
vote
1answer
181 views

How to add attributes to shapefile with Python and pyshp?

I'm using pyshp for creating a shapefile. I need to populate tens of fields with values using the record() method of shapefile.Writer. I have those values as a list, but have no idea how to send it to ...
0
votes
0answers
63 views

Why don't libgrass.so.1.8.0 and libqgissqlantconnection.so.1.8.0 load?

I have compiled Qgis 1.8 at Ubuntu 12.10, but some phyton plugins does'nt work, like sextante. Trying to solve this problem, some files don't have been load. They are: libgrass.so.1.8.0 and ...
-3
votes
2answers
907 views

What does Runtime error : 'NoneType' object has no attribute '<field_name>' mean?

Here is my code #arcpy import arcpy,sys from arcpy import env env=r"C:\Users\Jaya\Desktop\python_practice" totalRec=arcpy.GetCount_management("river") rows=arcpy.SearchCursor("river") ...
0
votes
1answer
1k views

How can I create a line with three points with Python in QGIS?

I'm new to Python and I'm having some dificulties. I want to create a simple layer with a line in the console of QGIS with Python. How can I do that?
1
vote
1answer
105 views

Setting More Than One Workspace

I have a number of tables that contain known values in a field. For example, I have a soil type table with one field in it. That field contains a list of known soil types. I have another table that ...
9
votes
1answer
3k views

GDAL/Python: How do I get coordinate system name from SpatialReference?

In Python, using GDAL, I've extracted a raster's projection as a WKT string as follows: wkt = dataset.GetProjection() # wkt is ...
0
votes
1answer
1k views

How to use variable field name in arcpy.SearchCursor?

I have code that says fld = fieldName rows = arcpy.SearchCursor(fc) for row in rows: x = row.fld How do I use a variable for my field name in python ArcGIS 10 on windows? Thanks.
1
vote
1answer
179 views

Need python code example - setting a combo listbox to Null

I want to be able to set the value of a field to Null using python, but I get an error. I am using arcpy.CalculateField_management Any help would be appreciated. Rob Smith
0
votes
1answer
488 views

Check if layer is a QGSVectorLayer from Python Plugin within QGIS

I am trying to extend some concepts in the QGIS Workshop tutorial. Basically, I would like to check if the layer is of type "QGSVectorLayer". In the QGIS Python console, I am able to type canvas = ...
2
votes
1answer
377 views

Generate unique ID upon creating a feature?

Looking for a way to generate a unique Global ID within a feature set when a new feature is created. For example, every time a sewer manhole is added, we need to generate a new unique Global ID that ...
1
vote
1answer
149 views

OGR UnionCascaded gives strange lines (flat polygons)

I'm using OGR to perform a union using UnionCascaded. All my polygons have been created by GDAL polygonize which ensures that all polygons follow pixel edges and should therefore align nicely. But I ...
0
votes
1answer
357 views

How to properly add a Python Module to a Plugin?

I've been trying to use a module that is installed in my local version of python, but whenever I open the plugin itself, it does not manage to locate said module. The module in this case is Noise ...
5
votes
2answers
2k views

How to do advanced Python labeling in Arcmap?

Does anyone have a good reference for advanced/complicated labeling expressions in Arcmap? I am attempting to write a Python label expression that would involve multiple label definitions. Here is ...
1
vote
2answers
1k views

ArcMap label expressions with Python

Having trouble here: I'm trying to use python to write selective label expressions. I have several concentrations and depending on its "_Ex" number I either want it labeled red, not red, or not ...
4
votes
1answer
809 views

Using matplotlib to create and export graphs automatically from ArcMap

I am going to start a project soon where, after the data has been processed in various ways, an output jpg showing a graph of the data should be produced. The workflow is as follows: 1. A feature ...
0
votes
1answer
519 views

Use subprocess.call with gdalwrap

I am now want to use subprocess.call with gdalwrap to clip raster from shapfile (in qgis 1.8.0) I use raster→projections→wrap(reproject)to generate command_line below gdalwarp -t_srs "+proj=tmerc ...
0
votes
1answer
535 views

AttributeError: HelloWorld instance has no attribute 'connect'

Here's the code: import sys,os import win32api from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * import ctypes from PyQt4 import uic class HelloWorld: def ...
0
votes
2answers
335 views

Splitting Shapefiles [duplicate]

I am trying to create a code that will accept the input of a shapefile, and separate each of its features into separate shapefiles into a specified directory location. Can anyone help ? I am trying to ...
2
votes
1answer
152 views

Script to either rotate existing text element or insert graphic element

I have about 300 maps that contain a text element that needs to be rotated. I am pretty new to python but I have heard how great it is. This seemed like the perfect task for python but I have had no ...
0
votes
1answer
84 views

How to buffer increasing/decreasing population zones?

I will find out the difference in population between year 2000 and 2013. I have a feature class file with the population in year 2000 and 2013 that are connected to the municipal number and that is a ...
2
votes
1answer
481 views

How to add one or more points to an existing polyline or polygon?

Using the following code, I make a polyline with two points. vl = QgsVectorLayer("LineString", layerName, "memory") pr = vl.dataProvider() vl.startEditing() fet = QgsFeature() ...
7
votes
2answers
227 views

How to use Python modules as data providers in QGIS?

I don't know if it has been discussed in the past. Qgis data providers can only load native compiled libraries (.so, .dll, etc) that offer the required interface. Is there anything blocking to the ...
1
vote
0answers
22 views

Calculate complete spatial randomness using Python [duplicate]

I currently use the csr() function from Splancs for R (http://cran.r-project.org/web/packages/splancs/splancs.pdf) to calculate complete spatial randomness (CSR) points to be used for spatial ...
1
vote
2answers
1k views

How to Add Shapefile with Symbology from Layer File to ArcMap MXD using ArcPy/Python?

Say I have a Shapefile: C:\DATA\points.shp A layer file: C:\SYMBOLOGY\symbology.lyr And a map document: C:\MAPS\map.mxd How can I add points.shp to map.mxd with the properties of symbology.lyr ...
0
votes
2answers
267 views

How to make line with arrow head in QgsVectorLayer using python?

I need to draw line with arrow head or after drawn the line i need to make it as arrow head line by using python. or can we set any arrow head symbol for line features by using python? Kindly help me ...
3
votes
1answer
321 views

TKinter to provide variables

I've been looking for a way to enter a unique field name into an attribute table for up to 40 feature classes. I need the field names to be meaningful, not just 'field1', 'field2' etc. For example, if ...
0
votes
1answer
497 views

psexec remote file execution with ArcGIS Server

This is perhaps going a bit out of bounds, so i'm not confident I'll get an answer. The short of this is that I've created a python script which leverages psexec to start a bat file on a remote ...
3
votes
1answer
611 views

Why is my simple arcpy script failing? (sets raster cell value to null if below threshold value, ArcGIS 10.1)

As mentioned in the title, simple script to set null cell values below three standard deviations beyond the mean: import arcpy, sys, os #Accept input and output raster inRas = sys.argv[1] outRas = ...
5
votes
1answer
518 views

How to access the road graph plugin in python?

I am developing a few scripts in Python for QGIS 1.8 to automate some geo-tasks and one of them would be to calculate the shortest distance from a hospital to each building in a town. I would like to ...