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

learn more… | top users | synonyms

2
votes
1answer
65 views

Creating lines from points in QGIS, python error ( 'NoneType' object has no attribute 'asPoint' )

I'm new to Qgis, and i'm stuck with a simple task, I have a csv file with points coordinates and i would like to connect those points in a path, I'm working with wildlife movement data. i've tried ...
8
votes
2answers
176 views

How to set transparency to multiple raster values with Python

With the following code I can set 100% transparency to raster value 0: map=None for lyr in QgsMapLayerRegistry.instance().mapLayers().values(): if lyr.name() == "some_layer": map= lyr tr=None ...
1
vote
0answers
60 views

Find Properties of Nearest Line Segments to Point in Python

I have been trying to find a workable Python approach to finding nearest line segments to one (or more) points, and came accross @gene's solution to @RustyMagoo's problem here: from shapely.geometry ...
0
votes
0answers
37 views

How to store large time series of raster images

I've got a large time-series of rasters, derived from satellite images. Each raster is about 2000 x 2000 pixels, and I've got about 10,000 individual images. I'm trying to work out what the best way ...
1
vote
1answer
75 views

How do I fill a Field Combo Box with vector layer fields in QGIS?

I am new to python and I am trying to write my first plugin for QGIS. Earlier I asked this question to find out how I could populate a combobox with point vector layers (and nothing else). I've been ...
3
votes
0answers
49 views

Cannot Open VRT of Sentinel2 image created by AutoCreateWarpedVRT

I am trying to create a warped VirtualRaster of a Sentinel2 image. Here the Python code I tried: from osgeo import gdal, osr srs = osr.SpatialReference() srs.SetFromUserInput('EPSG:32632') gdal....
3
votes
1answer
62 views

How do I fill a combobox in QGIS with only points vector layers?

I'm new to writing plugins in python for QGIS. I've been searching on internet for a while and wrote the code below. Even though it fills my combobox, all layers (rasters, vectors of all geometry ...
1
vote
1answer
22 views

Making a shapefile or kml tiles from a file that says it has no GCP

Learning my way through the GIS world, i was able to create a nice script to handle some geotiffed nitf files. Could create png, thumbnails and even kmls from these files with GDAL. Then I have ...
2
votes
0answers
23 views

Exiftool.exe in QGIS [closed]

I am developing a GIS application and in my code I need to call the exiftool executable which is installed in a different path. I call in command prompt and in OSGEO4W shell and both are fine. But ...
0
votes
0answers
20 views

splitting multipolygon with line

I am developing a QGIS plugin in python using mostly OGR that clusters features based on several conditions. One of the steps is to split the different multipolygon features (blue selection in image) ...
1
vote
2answers
22 views

Gdal vsicurl not working

I'm currently using gdal version 1.11.2 (also tested this on 2.0.0) to open AWS Landsat-8 data directly from its url. If I manually test the link in the browser, it works. If I use /vsicurl/ the ...
0
votes
0answers
32 views

Map Service properties (arcpy): Error parsing recycleInterval, recycleStartTime, keepAliveInterval

Need to publish web service using arcpy tuning up its properties through the parameter names passing them into function parameter_toggle (see code bellow). We are getting error (see picture bellow) in ...
4
votes
1answer
65 views

point created on a line not precisely on line

In QGIS I wanted to move points to the nearest lines. I checked the solutions here, but there are using tools which I am not familiar to yet(POSTGIS or GRASSGIS). I figured out my own way with using ...
4
votes
1answer
62 views

How to use joinFieldNamesSubset from QgsVectorJoinInfo class

I have written a small python plugin to refresh a join on a point layer in QGIS. point_layer=None for lyr1 in QgsMapLayerRegistry.instance().mapLayers().values(): if lyr1.name() == "point_layer": ...
0
votes
0answers
26 views

Creating superoverlay from geotiff covered whole globe, shouldn't of?

I am new to this GIS world and found this blog post: https://developers.google.com/kml/articles/raster#step-1-download-and-install-gdal Following its instructions I used my own geotiff (ntif) image ...
1
vote
0answers
17 views

Icon in title of dockwidget

Is it possible to incorporate an icon in the title toolbar of a dockwidget? Semi-classification plugin has this. Is it possible?
1
vote
0answers
18 views

Load a GeoJSON layer with mixed geometries via QGIS's Python module

I have been able to connect my collection in MongoDB , write and store the collection to as .json file and load the GeoJSON file as a layer by QGIS's Python module unless there are mixed geometries. ...
4
votes
1answer
49 views

Register custom qgsfunction in pyqgis

I'm using pyqgis within an standalone application. Now I wanted to create a custom expression to to use as filterExpression in rule of ruleBasedRendererV2. (I tried the renderer with existing ...
1
vote
2answers
53 views

Preserving special chars using osgeo.ogr.Driver to shape in Python?

I am converting kml files to shape and run in to the problem that special characters are not preserved. #!/usr/bin/env python # -*- coding: utf-8 -*- import os, ogr, osgeo, sys ogr.UseExceptions() # ...
0
votes
0answers
41 views

Merge neighbors together Qgis Python

I have one layer which contains lots of features (polygons), each feature represents a house and each house has an attribute called 'number-of-habitant'. What i want to do automatically with python is:...
1
vote
0answers
37 views

Spatially Analyzing two layers within same File Geodatabase using Python / Shapely?

I'm using a nested for-loop to do Shapely analysis between two Python lists created via two pre-reads of the same GDB file. One list contains all the features of a particular layer while the other ...
2
votes
0answers
41 views

Set Snap Mode with PyQGIS

I am trying to set snap mode within QGIS plugin. So far, I have tried: QgsSnappingUtils().setSnapToMapMode(QgsSnappingUtils.SnapAdvanced) and QgsSnappingUtils().setSnapToMapMode(2) without ...
0
votes
0answers
24 views

How to rasterize points in python?

I have a problem rasterizing a vector layer base from Count values. I am getting a black image. Below is my sample code base fromhttps://pcjericks.github.io/py-gdalogr-cookbook/raster_layers.html. Any ...
1
vote
1answer
46 views

Auto-complete function does not work In the QGIS python editor

I use QGIS 2.14.3-Essen. The auto-complete function works without any problems in the python console, but it does not work in the QGIS python editor. I also tried it on another PC running QGIS 2.14.3 -...
0
votes
1answer
97 views

Clustering of Spatial Data in R or Python [closed]

I am new to GIS. Problem Domain :- I have a stoppage data of different vehicle i.e. the point where vehicle stopped.There are some specific vehicle which stops at some particular point. So, I am ...
3
votes
1answer
45 views

QGIS QImage, can't specify a specific path

I'm a newbie in QGIS and I have to write a small python script to automate shapefile loading, applying style and save image. I'm having trouble on this last item. Here is the thing: img.save("...
2
votes
0answers
49 views

How to set “draw line inside polygon” using Python?

In the QGIS properties of a layer I want to activate "draw line only inside polygon" for a specific layer, but using Python. I don't want to use the GUI for it. Can this be done? I set the line ...
4
votes
0answers
154 views

How to generate surfaces of different heights from LIDAR points

I am seeking a way to generate surfaces (polygons in a 3D space) of different heights from LIDAR point clouds, whose spacing is 4 points per square meter. The typical application is like roofs, which ...
1
vote
1answer
42 views

PYQGIS Layer to KML?

I am aware that it is possible, in QGIS, to save your Vector Layer as a KML file manually, however, I want to know if there is anyway I can do this programmatically from an external Python Script that ...
7
votes
3answers
200 views

Programmatically finding polygons which are >90% overlapped by another vector polygon layer using QGIS?

I'm trying to figure out how to use python to extract the polygons in one vector that are overlapped by >90% by another vector. I would then like to have a vector/map that will only show those ...
2
votes
0answers
61 views

How to convert Shapefile to KML in Python

My goal is to extract certain shapes from a shapefile, and render the chosen shapes in a KML file. From searching gis.stackexchange, I was able to piece together the necessary components, and the ...
0
votes
1answer
67 views

QGIS Processing Toolbox not valid

I have a 64 bit windows 10 computer with ArcGis 10.2.2 Installed. I just downloaded QGIS the newest version 2.14 64 bit. it downloads but the processing toolbox throws this error Couldn't load ...
0
votes
1answer
25 views

Error operating on file using grass

from grass.pygrass.modules.shortcuts import raster as r gscript.run_command('g.region', raster='C:\\Users\\rit\\Documents\\PhD\\Projects\\Intensity\\input\\2008_cdls\\MI\\cdl_30m_r_mi_2008_albers.tif'...
0
votes
1answer
106 views

Parse and load GPX into database? [closed]

Having a PostgreSQL database, with the following tables: CREATE EXTENSION postgis; DROP TABLE IF EXISTS trips CASCADE; DROP TABLE IF EXISTS locations CASCADE; CREATE TABLE IF NOT EXISTS trips ( ...
1
vote
2answers
57 views

Extraction of raster with shapefile python

I have a raster tiff file containing vegetation index & also a shapefile of fields. I want to extract the field wise values from that raster file using GDAL. How can I do this? I can read the ...
1
vote
0answers
31 views

Qgis python: no interaction with Map Canvas

I've created a simple python script to load and show two layers and zoom to the first one. It looks like the script doesn't run the last 4 lines after I uncomment'print lyr1'. Anyway the map canvas is ...
0
votes
0answers
58 views

Mapinfo wor file not working when file paths are updated using python

We did a data move and so I scripted the updating of the wor, so the old file path is changed to the new file path. It looks like it works perfectly but when I open the wor file it doesn't. When I ...
0
votes
1answer
29 views

connecting Postgis, Python, Openlayers

I'm in the process of learning Geo-mapping and I'm curious to create a web-application Python-Django, Openlayers 3 and PostGIS. I need to know whether Django can be combined with PostGis and ...
1
vote
0answers
34 views

Per-pixel Descriptive Statistics through multiple Raster layers

I'm looking for computing different descriptive statistics through a set of raster layers. I need to make it with a python script capable of running into a standalone tool within the QGIS. To do so ...
0
votes
0answers
40 views

Transitioning MapServer from 32bit to 64bit: CGI Error

I am moving a mapserver system from 32bit to 64bit Windows (too many frustrations with multiple python installations). There is no straightforward MS4W installation for 64 bit. I am using Apache2.4 ...
0
votes
0answers
13 views

Tuning Geoserver datastore with gsconfig

I'm trying to create a datastore in Geoserver with gsconfig and it works, up to a point where i want to enable for instance "Expose primary keys" or "Support on the fly geometry simplification" tags ...
1
vote
1answer
37 views

gdal_polygonize returns with a strange error

i'm trying to execute gdal_polygoinize.py command. I have a main python method that takes in input a raster file and a output shapefile, and then calls a method named polygonize.py that builds and try ...
3
votes
2answers
88 views

Clustering geographical data based on point location and associated point values

Given data points with longitude, latitude, and a third property value of this point. How can I cluster points into groups (geographical sub-regions) based on the property value? I searched by google ...
0
votes
1answer
54 views

Why Does Fiona Crash Python When Creating an Output File?

I've basically followed the Fiona online manual verbatim to write an output file but my code crashes when I call Fiona.open() to create said output file. Traceback reports that the reason for the ...
2
votes
1answer
38 views

QGIS Python variable not updating after new features are inserted

I have the following script that sets the a feature id automatically after a new feature is digitized. I added the function inside the project's Macro section inside openProject() function: The ...
3
votes
1answer
33 views

QGIS python getting number of new features to be stored in layers

I mean, how could I get the number of features that have been created in a given layer and that are pending to be saved in the layer when "Toggle editing" or "Saving layer edits"?
1
vote
1answer
38 views

QgsMapCanvas object is not callable (Ubuntu with, Eclipse, Python & QGIS 2.0)

I'm basically borrowing the code for picking up a coordinate from a mouse click from this answer : How to programatically check for a mouse click in QGIS However in a stand alone application I do ...
3
votes
1answer
64 views

Replace non-ASCII characters in QGIS Field Calculator

I want to replace all non-standard characters from fields in a dbf table in QGIS. From http://stackoverflow.com/questions/20078816/replace-non-ascii-characters-with-a-single-space I see we can use ...
0
votes
0answers
25 views

When I open the software this message showed “Import Error No module named osr” . I am using QGIS 2.6.0 version

This is the image of the error that occurred. I was able to use the software, but I'm bothered by the error.
1
vote
1answer
34 views

How can I obtain selected value from QGIS using python algorithm?

I'm writing an algorithm in python for QGIS and i have a function which uses a value from a selection. The problem is that when i select a value the script give me the error that the local variable '...