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

learn more… | top users | synonyms

2
votes
1answer
35 views

Optimise Search within the QGIS API

I would like to ask you about the following code, it works, but I don't think is very helpful to have elif, elif,elif... always. Then, I have to optimise it. The problem is that I can't access to ...
2
votes
2answers
168 views

AttributeError: 'NoneType' object has no attribute 'split' from arcmap only

I'm running a simple python script from arcmap that sends an html post and processes the response. This script runs just fine from pythonwin but for some reason I receive the following error when ...
2
votes
1answer
92 views

Remove features inside a feature in shapefile using python (UNION, CONTAINS methods)

I have created a shape file from raster. The shapefile was generated using contours detection. I am in the process of automating feature detection using python and open source libraries such as ...
0
votes
0answers
8 views

Problems with Mapnik raster colorizer discrete not properly assigning values to their stop value

I'm using Mapnik (Python) to convert a raster (float valued) to MBTiles. In general the discrete colorizer is working fine, except for zero values, where it fails to recognize their correct stop ...
3
votes
1answer
85 views

Works in Console but not in Script Editor

On QGIS, I am using a simple script to zoom the selected features. I write them in the Text Editor, but it didn't work until I used the console... and it does work. What kind of problem is this? Is ...
1
vote
0answers
48 views

PyQGIS: vector layer does not get displayed after rendering

My project goal is to write a standalone app for Unbuntu and QGIS 2.14. It should get a layer of simple points and their name from a Postgres database and show them in a layer. In addition there ...
2
votes
0answers
35 views

How to use GDAL RasterizeLayer (python binding) -where flag

I am trying to use GDAL RasterizeLayer python binding, but I can not find a way to use the -where flag. The 'pure' GDAL command I am trying to run is: gdal_rasterize -b 1 -burn 0.00001 -where ...
0
votes
0answers
45 views

How to use SpatiaLite functions in a Python script?

I'm trying to find the intersection coordinates between a line (knowing its start and end points) and a polygon (SQlite file). I've managed to make it work in QGIS by creating a shapefile for the ...
2
votes
1answer
41 views

Use ArcGIS for Server geocoding service results in QGIS (or another generic approach)

An ArcGIS for Server geocoding service can be used via http get (singleline geocoding for 'Jugendamt' [youth office]) ...
1
vote
1answer
72 views

Load multiple files from folder for further processing

I'm working on a processing model and I'm looking for a possibility to load multiple shape-files from an Input-folder for further processing (first clip them all to a certain extend, then assign them ...
1
vote
1answer
38 views

Fail to compile QGIS source on Windows

CMake fails to configure. I get following error: Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "2.7" (found c:/cygwin/bin/python2.7.exe) which seems ...
1
vote
1answer
28 views

Operations lists arcpy

I have a list with 4 raster files and another list with 4 vector files. I want to relate each of the raster file 1 file list 1 vector list. I try to do and I related file 1 raster to vector file ...
1
vote
3answers
59 views

Querying dataset with .shp file?

I'm new to GIS tech. Please excuse me since I'm not yet familiar into using GIS. I will be using a very large dataset (yfcc100m dataset, a dataset containing metadata of Flickr's photos/video) which ...
3
votes
1answer
113 views

Using processing algorithm in QGIS plugin

I'm building a plugin in QGIS, one of its part is processing algorithm: intersection. I want to save the result as memory layer, and then work on it. Following code was working fine, nothing changed ...
4
votes
1answer
103 views

Implementing NNJoin in Python

I am curious to know on how to implement NNJoin into the python code. I have created a point shapefile using shapely. I have another shapefile which is a centerline and is used as a reference line. ...
2
votes
1answer
56 views

Suppressing rasterio verbosity

I have the following script using rasterio: if not os.path.isfile(out_dir + os.sep + name_adm1 + '.tif'): with rasterio.drivers(): with rasterio.open(constants.ras_cmask) as src: ...
1
vote
1answer
49 views

Select by attribute using fiona

with fiona.open(constants.file_combined, 'r') as source: filtered = filter(lambda f: f['properties']['NAME'] == name_dm1, source) # **source.meta is a shortcut to get the crs, ...
2
votes
2answers
59 views

QGIS explode lines from python script fails at alg.processAlgorithm

I've been trying to run QGIS procedures from python scripts via terminal on Ubuntu (ultimately I want to automate a process via cron). The first task I have tried to script is the "explode lines" ...
0
votes
1answer
48 views

GeoDjango - Find all locations within X miles of provided point using bounding box

I'm trying to implement some search functionality for a web app, and have run into an issue where I don't know the proper functions to execute this. Given a Point, a bounding_box database field with ...
1
vote
2answers
101 views

python rasterio error

When I am importing RASTERIO then i am getting an error as: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import rasterio File ...
1
vote
1answer
46 views

gdal/python WriteArray working for 8-bit but not 16-bit

I'm trying to use GDAL/python API to open a raster, do some math, then write the two resulting arrays as rastes. One is to be an 8-bit raster and the other 16-bit signed. However, only the 8-bit ...
0
votes
0answers
21 views

Update Postgis table by selecting features from other table

I am writing a QGis plugin which uses psycopg and python to interact with a Postgis database. When trying to update like title says, I get syntax errors. The basic idea is to update initial and end ...
1
vote
1answer
34 views

Available Python client libraries for WFS transactions?

I am looking for a Python module to allow me to use WFS-T. Everything I found so far only supports getting data out via WFS, I need to INSERT and UPDATE. owslib does not support WFS transactions ...
3
votes
3answers
55 views

QGIS Spatial join using subset of features?

I have a road network shapefile, as well as a postgis layer of different areas in a city. The areas file contains one big polygon containing everything (the service area), and then a series of ...
3
votes
1answer
61 views

How to get the feature id of features added to dataProviders?

My question is somehow related to the problem of finding the id of the last added feature: I am looking for a way to supply the feature id and another attribute of each added feature through a signal. ...
2
votes
1answer
24 views

Count Lat Lon Data Points Lying Between 2 Azimuths

I need to count the number of points (LAT, LON) from a cvs file that exist inside an arc defined by 2 azimuths. Ultimately it will need to be iterative where the arc defined by the 2 azimuths rotates ...
3
votes
1answer
77 views

Writing a custom function in QGIS to rank features

I have written the following custom function in python for QGIS, cobbled together from various sources. The aim is to use it in the expression editor to return the rank of each feature based on the ...
1
vote
1answer
75 views

How to create a new database in spatialite and insert the data using python in Qgis

I want to create a new database in spatialite and want to connect to the database and execute the sql queries. conn = db.connect('myDB.sqlite') # creating a Cursor cur = conn.cursor() sql = 'select * ...
2
votes
0answers
27 views

QGIS Override MapTool Python

My goal is to reuse the default edits tool of QGIS in a custom App. But I would like to modify some behavior with those tools. For instance, the MapTool beside the Edit Node Action. ...
2
votes
2answers
94 views

How to convert the CSV to point shape file using python

import csv,sys import osgeo.ogr, osgeo.osr #we will need some packages from osgeo import ogr from osgeo import * import osgeo.osr as osr def test(): boolValue = True canvas = ...
2
votes
1answer
39 views

How can I retrieve private tag GDAL_NODATA from a TIFF using libtiff?

In an earlier post I reported about my attempts to read TIFF with data stored in tiles using python and libtiff. First I tried to use libtiff's function TIFFReadEncodedTile but finally I tried ...
4
votes
2answers
65 views

How to select all features with maximum classification value using a processing algorithm?

I am building a Processing Model working with large vector Datasets with classification values. My vector file contains a lot of features (40.000) with one column containing classification values ...
3
votes
2answers
50 views

Cannot load vectorlayer PyQgis

I am having a hard time loading a vectorlayer from the console. Not from the Pythonconsole within QGIS, but from the console on my computer. I later want to write a standalone script! That is what I ...
0
votes
1answer
56 views

Pygrass ERROR: Mapset is not set

I am using Pygrass in a a Python Grass GIS stand alone application. I am using GRASS GIS 7.0.3 on a Windows machine and Python 2.7.4. I am initializing a new Grass environment. I can work in this ...
0
votes
0answers
55 views

Time series linear interpolation method for cloud not processing properly in my MODIS dataset

I am trying to perform an interpolation to my 3D array (sub-block of MODIS time series dataset with a shape of (46,960,960)) using numpy linear interpolation method to replace cloud pixels with ...
1
vote
1answer
52 views

How to create dynamic text in ArcPy that recursively reflects the exported layer name from a list of layers

I have a script shown below with the help from @Midavalo that exports irrig_0, citylyr, boundlyr as a GIF. Once this is done the script then exports irrig_1, citylyr, boundlyr as another GIF and so ...
0
votes
0answers
33 views

Redrawing multisegmented lines as arcs using measurements stored in attributes

I'm beginning the process of moving our local government cadastre data in to a topologically clean parcel fabric layer using ArcGIS. I'm at the stage where I'm looking to clean the data and get it ...
1
vote
2answers
50 views

How do I select shapefiles to be converted to GeoJSON in folder with multiple shapefiles?

How do I only select .shp's to read and then convert to .geojson. The homefolder has 3 different shapefiles and this code currently converts every single file in the folder to a .json. Just trying to ...
1
vote
0answers
24 views

Using model precessing save from qgis into qgis python plugin

I would like to know if there is anyway to load from a QGIS python script a .model file and run it through the processing.runalg method as it seems that we lost the capability to save our model as a ...
2
votes
1answer
136 views

Adding QGIS-specific Python interpreter to Eclipse?

I was following the steps from QGIS Python Programming CookBook to add qgis interpreter to eclipse, however I went into the following error in step 8: "See error log for details. No output was in the ...
2
votes
3answers
98 views

Can not Run function when item selected in comboBox. Pyqgis. QGIS

I'm writing a plugin, I want to change the content of a comboBox (fields) depending of the content of another comboBox (layers). My plugin is a dockwidget. I can populate the fields comboBox just ...
2
votes
1answer
70 views

pyQGIS segfault

I am trying to get started with pyQGIS but failing pretty hard. Trying to follow http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html A lot of it seems incomplete for Windows ...
6
votes
4answers
137 views

PostGIS query for selecting features not connected to rest of road network?

I have a dataset of roads in a city stored in a PostGIS enabled database. I would like to identify and remove any feature which is not connected to the rest of the road network. This behavior is ...
3
votes
0answers
136 views

QGIS 2.14 Processing plugin crashes - TypeError: must be string, not None

I've recently installed 2.14, and it worked fine for the first couple of days (Appart from Grass tools), including several program and computer reboots. Today I had this error show up Couldn't load ...
6
votes
0answers
97 views

Can a memory layer be used as an input and/or output with runalg?

Can a memory layer be used as an input and/or output with runalg? With runandload I get this to work: processing.runandload("qgis:mergevectorlayers","memory:bufferOne", "memory:bufferTwo", ...
0
votes
0answers
22 views

Fetching the table data from SQlite db in QGIS throws an error

I have exam.sqlite db and it contains 4 tables as t1,t2,t3,t4. from pyspatialite import dbapi2 as db sqlite_file = r'D:\Folder\exam.sqlite' conn = db.connect(sqlite_file) ...
3
votes
2answers
63 views

QGIS pyqgis: Trouble loading non-spatial data via .csv using python for standalone script

I cannot for the life of me figure this out. I am trying to load a .shp file, and a non-spatial data table .csv file. Then join the table to the shape file. Both files have a primary key. Here is ...
3
votes
1answer
39 views

While populating table of memory layer one record is missing

I have script that calculates length of lines and adds values to attribute table. It works for vector layer, but for memory layer it skip always one value, as you can see on the pic. I calculated ...
2
votes
1answer
19 views

Trying to get PRECISE vector coordinates using geom.asPolgon

I've got a bit of a problem. A script I've written is trying to get the coordinates of every vector in a layer, which is MAINLY working: output_file = open('c:/myfile.txt', 'w') layer = ...
1
vote
1answer
55 views

Point otbApplication for python to the relevant OTB DLL's

I installed the latest OTB and Monteverdi on a Win 7 machine. Via osgeo4w I downloaded otbApplication for python, without any dependencies. Python, gdal, numpy scipy and so forth was custom build ...