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

learn more… | top users | synonyms

0
votes
0answers
57 views

PyQgis: How can I “append” features to a Vector Layer instead of “stacking” them?

As I read data from a text file and add points to a QgsVectorLayer (as well as related attributes), each new record gets 'stacked' on top of the previous one in the Attribute Table (and within the ...
0
votes
0answers
39 views

QGIS Python API: SAGA difference algorithm does not split parts

I am using the QGIS Python API in an external script (platform: ubuntu). Everything works as expected. But when I am using the SAGA difference algorithm within the script, there is an issue. The ...
0
votes
0answers
20 views

'QgsGraph' object does not support indexing

Traceback (most recent call last): File "/home/kasun/.qgis2/python/plugins/floogin/floogin.py", line 246, in findRoutes path=self.astar.astarSearch(graph, start, end) File ...
0
votes
0answers
44 views

Draw polygon shape via Qbutton

Ideally; a Ui Qbutton is needed that will activate map canvas editing to add a polygon via the classic mouse click rubber band method. Upon a concluding right click with the active tool, editing ...
0
votes
0answers
48 views

gdal commands cannot import gdal — possibly ArcGis conflict with separate Python?

I installed ArcGIS 10.1 yesterday (Windows 7 64-bit), but have a separate Python 2.7 installation. Now my gdal does not work correctly anymore. It looks like all commands without the ending "*.py" ...
0
votes
0answers
31 views

Running algorithm from Processing takes much much longer time than doing it from Qgis GUI

I have a road layer with 32000 features, and I want to find all the intersections. when I use processing->SAGA -> convert polygon/line vertices to points, it is all done in less than 5 seconds. ...
0
votes
0answers
25 views

QgsFeatureRequest and QgsVectorLayer are missing in the QGIS

I am trying to use part of my friend's code in eclipse written in Python using QGIS APIs. I have installed the QGIS 2.2.0. now before running the code, it seems that something is missing here. All ...
0
votes
0answers
26 views

Using GDAL and Python to replace the Spatial Analyst TabulateArea method

Has anyone tried to phase out the use of ESRI's Spatial Analyst extension by replacing it with GDAL in Python? I have a script that only uses the TabulateArea and Statistics analysis but not much else ...
0
votes
0answers
20 views

Is it possible to compile a grass addon into a commandline app?

As the title says, I'm wondering if it's possible to take the source of a grass add-on and compile it into a commandline app. Or, alternatively, use the add-on in a python program. Basically, I ...
0
votes
0answers
35 views

Shapely tolerance overlapping layers

Is it possible to define a tolerance by applying a overlapping layers function in Shapely?. I'm trying to make an intersection between lines but the results are different with other GIS. regards.
0
votes
0answers
34 views

when using arcpy.mapping.ListDataFrames, python.exe crash

Has anybody had this problem? this drive me crazy. what is wrong with my code? import arcpy mxd = arcpy.mapping.MapDocument(r"D:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd, ...
0
votes
0answers
77 views

GRASS “Argument list too long” with run_command

I have a python script that uses the grass.script.run_command function to read in, process, and export a bunch of raster files. On projects where I have a large number of rasters (>1,000), it fails ...
0
votes
0answers
16 views

Is it possible to override default QGIS error messages?

From my QGIS plugin I would like to override/replace one of the the default QGIS error message ("The layer layer_url is not a valid layer and can not be added to the map") with my own message. I have ...
0
votes
0answers
39 views

leaflet.js ImageOverlay projection bug

We are trying to display a image over the leaflet map using "ImageOverlay" layer, but it does not work according to expected. In Google Maps works perfectly. Apparently Leaflet just stretches the ...
0
votes
0answers
19 views

Using file directories from a table

I have a toolset that will be using a set of file directories as input (shapefiles, raster etc.).The table can be stored as CSV or DBF. Is there a way to read a specific cell (row,column) of the ...
0
votes
0answers
48 views

Accessing CRS info with pyqgis in a standalone application

I'm currently having trouble accessing and defining CRS information in a standalone application. I've read the API documentation and have tried it in the python console in QGIS 2.2.0. The python ...
0
votes
0answers
41 views

How to pass a layer to a thread in PyQGIS?

In my plugin, a user can select one of the loaded layers from a combobox, and then proceed to do further calculations. These calculations are done in a separate thread, "WorkerThread". My question is ...
0
votes
0answers
20 views

Call post-execution command manually in QGIS Processing

I wrote myself a Processing Script and it works fine. Now i want to style the outcome (a new raster layer) with a QgsColorRampShader(), but the problem is that Processing adds the output after the ...
0
votes
0answers
51 views

MODIS products reprojection problem

I am working with Modis Data (MOD02, MOD11, MOD03, MOD35). In particular I am looking for a solution to reproject the subdatasets below, into albers equal. Because I am using NLCD dataset which uses ...
0
votes
0answers
48 views

error when running a script for clipping a group of rasters on QGIS 2.2 OS X 10.9

I'm trying to clip a group of raster files on QGIS 2.2 (KyngChaos) running on OSX 10.9. When I run the script I get an error related with the location of the files. I'm wondering if this is something ...
0
votes
0answers
26 views

Cross platform gis api wrapper architecture

I have a python class library for arcpy which is just a couple of class definitions with my common code attached as methods and properties so that I can do code centralization for stuff that I have ...
0
votes
0answers
37 views

need help creating layer with geom type wkbGeometryCollection with gdal python

I am having trouble creating a layer with geom type as geometry collection. Thus I am unable to output to a shapefile. I have attached code below. dstLayer is null. This does not happen if geom type ...
0
votes
0answers
43 views

Import GRD and count days with temperature below zero, using python

Minimum temperature of a year is given in GRD file. I have to read that file and then calculate the frost day (less than zero degrees celcius) from it in python.
0
votes
0answers
71 views

QGIS custom form and autocompleted data entering with “validation check”

In Qt-Designer I created a custom form where I can choose serveral species names in two different combo boxes. This combo boxes are linked via "value relation" to the accordant non spatial tables ...
0
votes
0answers
40 views

argument 1 has unexpected type error when parse xml with ElementTree

I try to make plugin in QGIS Dufour to open and read xml metadata and then to show some information in metadata i try to parse it with ElementTree and then show it in QLineEdit, this code i use to ...
0
votes
0answers
65 views

aggregate counts on a grid and determine grid adjacency

So here is the problem I am working on. I have a bunch of lat, long coordinates for event occurrences. I want to create a grid and then count how many points fall into each grid pixel. Once I have ...
0
votes
0answers
127 views

How to export from ModelBuilder as script and then run using Python. 3.4?

I'm currently studying for a Msc in GIS. In my assignment I have been asked to produce a model, export that model as a script file and then run that script as a stand alone in IDLE. So I have created ...
0
votes
0answers
32 views

Error 14: Could not open CRS database

I am using Python Console and loading a Vector Layer using python commands. When the layer is added, QGIS first asks for the CRS to use, but I don't have all the CRS listed out to select the Reference ...
0
votes
0answers
45 views

MODIS images set CRS and reproject

I am developing a plugin which reads MODIS images, and I know that MODIS images are in sinusoidal projection and I need to set that CRS and project the image to WGS84 (epsg 4326) in python. I search ...
0
votes
0answers
37 views

custom toolbar combobox: issues with adding functionality

I've added a combo box to my custom toolbar in QGIS (based on this thread QGIS - Add a combobox to a toolbar), but it doesn't populate unless I reload the plugin. def __init__(self, iface): ... ...
0
votes
0answers
18 views

Error while running OSGeo4W setup

i'm not sure if i got a problem with osgeo4w or with python. but i get an error message if i run setup: C:\>setup C:\>Exception in thread Thread-5: Traceback (most recent call last): File ...
0
votes
0answers
31 views

QgsMarkerSymbolLayerV2 not rendering

For the life of me I cannot get a custom vector layer symbol to render. Following is the code I am using, as fas as I can tell renderPoint is never called. Is there something I am missing here. The ...
0
votes
0answers
15 views

ogr: confusing results from `SetSpatialFilter()`

My layer is derived from a data source like this: l_131 = bounds.ExecuteSQL("select * from 'nam_l' where 'ND_5'= 131 ") feat = l_131.GetNextFeature() feat.GetFeatureCount() >>> 200 It is a ...
0
votes
0answers
124 views

Help with scripts for processing raster files with the raster calculator in QGIS

I am trying to process some raster files using python scripts in Qgis 2.20, and I have been having trouble finding any documentation on using raster calculator in scripts being run in the processing ...
0
votes
0answers
58 views

Add existing QGIS plugin button to custom toolbar

Is it possible to add an existing plugin's button to a custom toolbar? I've succeeded in adding core actions such as shown below, but am wondering if it would be possible to integrate another plugin ...
0
votes
0answers
101 views

Mapnik: GeoTIFF flipped (mirrored vertically)

I generated a GeoTiff using the QGIS HeatMap plugin and want to render it on top of some OSM data. The problem is that the raster gets rendered upside-down in the output. Can someone point me in the ...
0
votes
0answers
23 views

Min value (OD Cost Matrix)

I have an attribute table with columns that I have gained from running an OD Cost Matrix. In one column named "Total Minutes" I will select the lowest value (the shortest route). Then I will create a ...
0
votes
0answers
23 views

In QGIS Process Modeller, is it possible to automatically run a function on several layers without listing all combinations?

Trying to develop a Model which includes finding any intersections between layers and then merging them all into a single layer. I have 12 layers in total, it's not really efficient to list all the ...
0
votes
0answers
46 views

How to calculate the area of an ellipse on the earth's surface using Python?

I have a dataset consisting of GPS coordinates. I use a clustering algorithm to generate a two dimensional Gaussian for me. The Gaussian takes the shape of an ellipse if visualized on the map. ...
0
votes
0answers
39 views

Problem reducing the width of the attributes fields of a shapefile using python

I have a shapefile with rather long attribute widths (which is resulting in a rather large file). I am trying to trim it in python, here is my code: layer = qgis.utils.iface.activeLayer() ...
0
votes
0answers
86 views

How to convert .shp file to zip file with mapnik?

I am creating android application for campus indoor map. I research so much think.I decide use osmdroid. I write here what I have done 1) I draw indoor map with JOSM. 2) I convert file.osm file to ...
0
votes
0answers
25 views

Does a road connect one grid cell to an adjacent grid cell?

So here is the problem I am working on. I have an OpenStreetMap roadmap which I overlaid with a 2-D cartesian grid. So for a given grid square, I want to find out if a road segment continues from the ...
0
votes
0answers
42 views

Check if Openlayer Layer is empty, caused by nonexistence of internet connection?

I use Openlayer Google street map as a base-map in my QGIS plugin projects. i want to check programatically if the layer is loaded or is empty and decide if i load my offline base-map instead of ...
0
votes
0answers
49 views

Using iface.showAttributeTable() on QgsVectorLayer retrieved by getObject()

I'm unsure if i'm properly using the processing.getObject() function. I'm creating a python processing script for QGIS 2.0 and 2.2, but can't seem to get an attribute table to open programmatically. ...
0
votes
0answers
101 views

Issue blocking QGIS feature form dialog with Python

I'm not sure where I'm going wrong with this python logic for a custom form in QGIS 2.0.1. There are a few things required by the validation function: that index of combo boxes aren't 0 (first index ...
0
votes
0answers
37 views

QGIS Plugin: Show a symbol at coordinates

I want to code a plugin for QGIS showing a specifig image (e.g. a .png or .ico file in the file system) at given coordinates. The background is, that I'm receiving coordinates and other information ...
0
votes
0answers
28 views

RemapValue Usage

I successfully produce and empty cost raster at the end of this script. I am fairly confident it has something to do with RemapValue parameters? Does anyone know why my out put cost distance raster ...
0
votes
0answers
50 views

Programmatically add paramaters to ArcToolbox based on number of FCs in GDB?

I'm creating a custom geoprocessing tool. If a user inputs a GDB with a variable number of feature classes (FC), how can I retrieve and add a list of the FC to the tool? If the user doesn't add a ...
0
votes
0answers
67 views

PyQGIS loading layer style with PostGIS

I'm loading layer styles from .qml files in a Python plugin. I'm about to switch to loading them from a non-local postgreSQL db. I've been looking at the (from QgsVectorLayer (v2.2)) ...
0
votes
0answers
58 views

Data driven page error when adding world_file

my python script for data driven pages causes a runtime error when I set world_file=True, or geoTIFF_tags=True. Else it runs and shots the ddp - in this case a grid of my city. I'm searching the web ...