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

learn more… | top users | synonyms

1
vote
1answer
67 views

Python + Grass: No such file or directory: 'PERMANENT\\MYNAME' (solved)

I have an existing Python script that processes raster images with Gdal / Numpy. Now I want to extend the script with Grass. The python script is developed on Windows 7 with Eclipse/Pydev. The script ...
1
vote
1answer
174 views

How to make offsetting points perpendicular to a line (without ET GeoWizards)?

So I'm trying to create offsetting points perpendicular from a line and have run into a roadblock in Arc 10.1. I have the ability to use the ET GeoWizards tool 'Points Along Polylines' but the tool ...
1
vote
2answers
45 views

Missing lxml in QGIS 2

I made a QGIS plugin in QGIS 1.8 doing a lot of XSLT transformation and other XML handling with the library lxml. After upgrading to QGIS 2.0 this plugin does not work anymore: "ImportError: No ...
1
vote
1answer
164 views

How to label vector features programmatically?

I am using python for QGIS 2.0.1 and I have a vector layer of points representing the positions of state labels. I want to display the 'state abbreviation' attribute on the corresponding point for ...
1
vote
1answer
107 views

Help with field calculator in Python script

I am getting a syntax error in my script but I know from testing it in ArcMap attribute table, the syntax is fine. Anyone have any idea why this code doesn't work? I see that a search cursor has been ...
1
vote
2answers
63 views

SUDS (SOAP) from the Python console in QGIS

I´m trying to install a SOAP API called SUDS, on a Windows 7 OS, to be able to run SOAP from the QGIS Python console and pyQGIS/Python scripts. The only Python I have installed is the one comming ...
1
vote
1answer
67 views

how activate qgis features selection toolbar in the main window

How can i activate and desactivate qgis features selection toolbar in the main window using a signal in a python plugin?
1
vote
1answer
74 views

Different output from running algorithm in toolbox and from script

I am unable to get the same results when running the qgis:reproject tool from QGIS processing toolbox (QGIS version 2.0.1) as when running it from a Python script (console). In this example I am ...
1
vote
1answer
85 views

QGIS Python Composer Attribute Table has no content

I post 2 Month ago the same question. So I try it a second time with more code. My Problem still is that I add at the composer a attribute table and in this table there is no content. My Code: ...
1
vote
1answer
74 views

Is it possible to move/shift an annotation to a new XY using Python?

Real quick question, I was wondering if it is possible to move/shift an annotation to a new XY using Python.
1
vote
1answer
110 views

How to recode and recalculate Field Values using ArcPy?

I am trying to figure out how to do several calculations through python and the arcpy set. I have an large dataset (7+ million records of individuals), and I am trying to code a value of 1 that ...
1
vote
1answer
92 views

PyShp 1.2 creating Polyline from GML

I have a problem in creating some polylines in one Shapefile with PyShape. The plan is to read a GML file containing LineStrings and create a shapefile. The theory is clear, but the realworld is ...
1
vote
1answer
89 views

Buttons (Ok, Cancel) disappear in “Apri Modulo” from Attribute Table in QGIS 2.0.1

QGIS 2.0 has changed the visualisation of a form opened from the attribute table: instead of opening the form in a separate window, the form is opened in the same one. This is not a problem, but all ...
1
vote
1answer
125 views

issues with updating data source, script runs but nothing happens, arcpy

I have seen many questions posted that are similar to mine but still havent found the answer so figured I would post my script. I want to change all the data sources found in all mxds in a location to ...
1
vote
1answer
55 views

CalculateField_management

How to put the field from arcpy.GetParameterAsText() into the expression here: CalculateField_management(in_table, field, expression, {expression_type}, {code_block}) Now it is like ...
1
vote
1answer
111 views

trouble deleting data in an fgdb using python

I am trying to use delete_management to delete files in a gdb based on whether or not they are in a list. I keep getting an error with the delete_management tool that says the file either does not ...
1
vote
1answer
286 views

How to create a feature class in memory?

I am trying to create a feature class in memory but I am not sure how to use the syntax. My code looks like this: FC = arcpy.CreateFeatureclass_management("", "in_memory/FC", "POLYGON", "", ...
1
vote
1answer
117 views

Select a single entry using SearchCursor and create variable

I am trying to select a single entry of a floating point entry in a dbf table that contains 9 entries (sampled from a raster image), some of which is NULL using SearchCursor. I want to select one of ...
1
vote
1answer
72 views

How to correctly use LIKE in the code block of a Reclass expression in ModelBuilder Calculate Field

I have a Reclass expression that works when i am search for single instance of a data field. I also wish the Reclass to work with a SQL type LIKE selection with Wildcards. e.g. I need to reclassify ...
1
vote
1answer
121 views

Python Field Calc for Document Hyperlink

I am trying to create a script that will hyperlink to a .tiff or .pdf. These files are stored in one folder on a shared server. I want the script to look in a field: 'PLAT_IMAGE', which has the plat ...
1
vote
1answer
172 views

remove whitespace Python code results in odd character - Field Calculator

I need to remove whitespace from the end of a string in a field in ArcMap. I tried first the VBA function RTrim, but whitespace still remained. I thought maybe the whitespaces were tabs, so I tried ...
1
vote
1answer
110 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 ...
1
vote
1answer
221 views

Failed to convert polygon to raster

I have two steps here. First select layer by attributes. Second convert polygon to raster. It failed when it goes to second step and kept giving me error 999999: Error executing function. I pasted my ...
1
vote
1answer
147 views

reclassify vector data from multiple source data fields (ArcGIS) (ModelBuilder)

I am using ArcGIS 10.1 and ModelBuilder. I am not familiar with Python. My question is very similar to ReClassify Vector Data Between Values . However that question is about reclassification using ...
1
vote
1answer
114 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 ...
1
vote
2answers
102 views

Optimising Min/Max temporal raster search in python/gdal

I need to search across ~100 1200x1200 raster tiles and produce a min and a max raster. Along the way i also want to exclude values that are over 1 or less than 0. What would be the quickest method to ...
1
vote
1answer
162 views

How to avoid setting env.workspace and other paths/settings all the time

I have some scripts that are constantly setting env.workspace of arcpy. Usually, I have a caller script(script1.py) that may call some other script (script2.py). I've created a file globals.py with ...
1
vote
1answer
81 views

Dan Patterson's bounding containers

I used a toolbox by Dan Patterson () and the problem is that the new shapefile does not contain any field from my original shapefile and this is a problem because I can't join the two layers based on ...
1
vote
1answer
696 views

arcpy.env.overwriteOutput = True, not working for some reason

AOI_test = "AOI_test.shp" arcpy.env.overwriteOutput = True for i in loc_list: AOI = "AOI_" + i + ".shp" arcpy.Select_analysis("locality", AOI, " \"LOCALITY\" = '%s'" % (i)) ...
1
vote
1answer
182 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 ...
1
vote
2answers
145 views

How to add non spatial sqlite table to map using python in qgis?

Is it possible to load pure sqlite 2.0 (without spatial extension) table into qgis using python? I would like to get the same result as in the case of using Add Vector Layer -> All files. I have ...
1
vote
1answer
73 views

How to set default bad layers handler in the python plugin?

I am trying to write a python plugin for QGis. My python plugin will copy a template qgis project into data catalog with ESRI shapefiles. Because data catalogs can vary in its content there will be ...
1
vote
2answers
40 views

Convertfeaturestographics Tool or Program

Problem : With over 19 feature classes in our dataset, we need to convert all these featureclasses to graphic . But to do it programmatically, we searched the resources but could not find a Python ...
1
vote
2answers
222 views

Convert 3D WKT to 2D Shapely Geometry

I have the WKT of many linestrings which contains three dimensions, however my script only requires a two dimensional linestring and I therefore want to discard the third dimension. My current code, ...
1
vote
2answers
137 views

How to place points along a line in a specific offset using python / arcpy?

I have a street shapefile with information about the street name, house number from / to on the left side and house number from / to on the right side. My aim is to create a point shapefile that ...
1
vote
1answer
97 views

Can I append to different tables using ogr2ogr?

I have been through many related questions and links but I am still confused as to how/if this is achievable. So, I have defined tables in my postgis database and I would like my ogr2ogr commnand to ...
1
vote
1answer
61 views

Get the ID of polygon in edition sessions of QGIS?

I did a Qt custom form for QGIS which contain a QlineEdit that must get the ID of the current polygon in edit session. For example, I start edit sessions I draw 3 polygons when the Qt form is opened ...
1
vote
2answers
76 views

To select one stream segment at a time for processing

I have attached my stream order network image. I have five different order streams. There are several segments in each order. Now my problem is to select one segment of stream at a time for the ...
1
vote
1answer
189 views

Looking for PyQGIS Syntax Examples/Guide

I am a long-time user of arcgis with intermediate experience python scripting for automation of geoprocessing workflows. I am moving towards using QGIS on the regular and I would like to dive into ...
1
vote
1answer
89 views

How to reach a field value of a record in field calculator in ArcGIS 10.1

I have two fields showing number of people in two age groups "young" and "old". these people also live in a cell (point) whose distance to a specific facility is calculated. then I categorized these ...
1
vote
1answer
398 views

Trigger a python script to run after a row is added to the feature class

I have a Python script which runs on a SDE feature class daily (as a scheduled task). I would actually like this script to run whenever a new row is added to the feature class (data is captured in the ...
1
vote
1answer
247 views

Creating an Origin/Destination (OD) cost matrix using ArcPy

I have created a python script that runs an OD cost matrix over five years from 1999 to 2004. I have set up an OD cost matrix for each year, which I think is very cumbersome. Is there someone who can ...
1
vote
1answer
225 views

Combining polygon geometries with python and QGIS segfaults

I am trying to combine polygons, using Qgis 1.8, and every time I run this script in the python console, I get a segmentation fault. Here is the script: from PyQt4.QtCore import * iface = ...
1
vote
1answer
361 views

How to use CURRENT map document in Python tool?

I am attempting to use this code in a tool that I am working on: mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] XMIN = df.extent.XMin YMIN = df.extent.YMin XMAX ...
1
vote
1answer
131 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 ...
1
vote
1answer
300 views

spatialite.dll with Python and QGIS - the specified module could not be found

I'm having a bit of a nightmare getting to the bottom of this DLL loading problem. The stand alone script works absolutely fine but the exact same code does not work within QGIS. import sys from ...
1
vote
1answer
73 views

ArcGIS 9.3 geoprocessing service output consideration

I'm developing geoprocessing service which do few processes with geographic data. I would like to get somehow geometry of those data and use it in my web aplication (JS ArcGIS API). Now I'm wondering ...
1
vote
1answer
107 views

python gdal_polygonize error

I am trying to use gdal_polygonize to create a polygon from a binary raster. My code is: os.system('gdal_polygonize.py ' + filename + ' -f ESRI Shapefile ' + shapefile) where filename is a string ...
1
vote
1answer
107 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 ...
1
vote
2answers
514 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 ...