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

learn more… | top users | synonyms

1
vote
0answers
15 views

QGIS cannot load macro function?

This has me stumped. For some reason, I can no longer run a function from a project macro even though macros are enabled (from Settings > Options > General > Enable macros > Always). Just ...
1
vote
0answers
16 views

QGIS 2.14.1 Processing Plug-In does not work anymore (Python error)

I did not change anything and started QGIS 2.14.1 today and was greeted with the following error message. So the Processing tab is missing and I cannot activate it. The error: 2016-04-26T17:58:43 1 ...
1
vote
0answers
36 views

QgsMapCanvas not fully rendered and missing some layers in PyQGIS standalone script

I've been working with the script below with the help of @Germán Carrillo. The script renders all of the correct layers when showing the canvas window and exports the individual Div1_Irrig... layers ...
1
vote
0answers
27 views

Eclipse PyDev has quit recognizing QGIS objects

I followed the instructions for setting up Eclipse with PyDev to start creating QGIS plug ins found here: http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/ide_debugging.html after doing ...
1
vote
0answers
24 views

Python GDAL open dataset in PostGIS with quotations

Error trying to use gdal to open a dataset in PostGIS with the following code: ds = gdal.Open("PG: dbname=nyc host=localhost user=postgres password=mypassword port=5432 mode=2 schema=public ...
1
vote
0answers
22 views

Using “Ruled Based Render” to display labels without the marker with python in QGIS

I'm writing a script to load and manipulate some shapefiles. Unlike my previous question I now need to display labels only on certain zoom levels. My usual result is that the previous formatting gets ...
1
vote
0answers
35 views

Python error in Qgis 2.14.0

I'm trying to build virtual raster (catalog) following instructions from the documentation in QGIS.. It appears the following error in python code: 2016-04-17T12:13:07 1 Traceback (most recent call ...
1
vote
0answers
17 views

QGIS plugin 'Module' object has no attribute 'classFactory'

I am trying to learn how to make QGIS plugins and have been trying to follow tutorials such as this one; https://anitagraser.com/2014/04/26/getting-started-writing-qgis-2-x-plugins/ but I keep ...
1
vote
0answers
32 views

ogr2ogr - Shapefile database SQL query; missing .cpg and .xml

I am using gdal and ogr2ogr to perform a SQL query on a database of shapefiles with the code below. The geoprocessing works and the appropriate shapefile is extracted from the query, but when I print ...
1
vote
0answers
18 views

Python plugins not available, OS X 10.10.5, QGIS 2.8.4

I’m using OS X Yosemite 10.10.5 and QGIS 2.8.4 Wien. My mainproblem is that python support is disabled and I can’t use python plugins. QGIS seems to act fine and I’ve done a lot of work with QGIS. ...
1
vote
0answers
23 views

Resampling netcdf file?

What is the best way to change the cell size of a netcdf file, keeping it as netcdf? I have looked into ArcGIS and GDAL and have not found anything yet. I prefer to use python if a solution is ...
1
vote
0answers
32 views

QGIS python support disabled

I'm having a problem with the python support of my QGIS version. When I start QGIS, I get the error message: Traceback (most recent call last): File "", line 1, in ImportError: Module use of ...
1
vote
0answers
64 views

How to make NoData transparent?

I have been using python to turn a netcdf into a geotiff. Once I have the geotiff, I am using gdalwarp to transfer it into the right projection. Then use gdal_translate to get the tif into a vrt ...
1
vote
0answers
54 views

mosaic rasters with gdal_merge.py

I want to mosaic 2 rasters "rasa" and "rasb" using gdal_merge.py . While running the code, it produces an error " No input files selected". Can somebody help me to find the error in the code? ...
1
vote
0answers
31 views

Programmatically adding folders & layers to QgsComposerLegend

I've been building up QgsLayerTree object with a directory structure that reflects the desired legend. Specifically I'd like the Group(s) to be titles and their contained layers to legend items. ...
1
vote
0answers
41 views

How do I calculate the percentage of progress using raster data using Python?

How do I calculate the progress amount of two or more raster data being processed? I have seen examples of vector data but it becomes difficult to calculate the progress when no vector data are ...
1
vote
0answers
16 views

pyqgis change or update attribute data with real-time data or Timer update,Memory has been growing

I update my shapefile attribute data by QTimer ,and labling it, keep the lable visiable,change attribute by 1 minute, but the Memory has been growing 1 layers ...
1
vote
0answers
89 views

QGIS 2.14 Couldn't load PyQGIS. No module named Qsci

When I open QGIS Version 2.14 Essen, I get the following error message: Couldn't load PyQGIS. Python support will be disabled. Traceback (most recent call last): File "", line 1, in File ...
1
vote
0answers
19 views

CityEngine: Extruding Buildings

I have written some code extrude buildings, taken from another forum which had previously worked for others. However, it is not working for me. I have attatched two screen grabs, if anyone could ...
1
vote
0answers
33 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 ...
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 ...
1
vote
0answers
28 views

Received a python error when I clicked on new catalog in QGIS Geoserver

What shall I do if I Python error message is there when I clicked on new catalog in QGIS Geoserver. I have the same message: Python error: An error has occurred while executing Python code: See ...
1
vote
0answers
36 views

How analyze reliability of position of new point based on point data

I am working on filter for biogeographical data. It is based on citizen science principle. People put new point data to database and I want add information about "reliability" or probability (maybe ...
1
vote
0answers
18 views

Local Maxima (or Pour Point) Pixel Value extract in Raster

I am doing watershed & pourpoint using python GDAL. I have calculated Fill, Flow-Direction & Flow-Accumulation using Python & GDAL. The next is to get Pour Point in certain window ...
1
vote
0answers
104 views

Convert PLSS (Section, Township, Range, Meridian) to Latitude and Longitude using R package or Python

I have data in the form of Section, Township, Range and meridian. I have 300,000 data points from all over the USA. Is there any way i can write R or python scripts to batch convert all the points to ...
1
vote
0answers
36 views

Python MapServer MapScript & Mongo - Use GeoJSON String Vs File

I have been using Python MapScript bindings for MapServer - and they work great. A new datasource for the application I am working on is MongoDB. I have seen mentions of a MongoDB Driver for ...
1
vote
0answers
25 views

unexpected change of area

Selecting a vector layer and running the following script, I expect the total area of my feature-geometries to be the same at the end of execution. from shapely.wkb import loads from shapely.ops ...
1
vote
0answers
39 views

Correcting for offset

I have a shape file with RTK measurements as a line feature, which more or less corresponds with visible features in a raster layer (shaped as lines). These measurements however are not accurate ...
1
vote
0answers
26 views

Flipped (Y-axis) Raster from point cloud

I have been working on a project where I need to create rasters from irregularly spaced point clouds. I am resampling my point clouds to a regular 0.25 cm grid using a nearest neighbor method ...
1
vote
0answers
88 views

How to install xlw and xlrd libraries on MacOS so that QGIS Python can see them?

I experience a problem with XYtools and need to install Excel libraries for Python. I tried to install them directly from the terminal and it worked on the system, however, how to import them into ...
1
vote
0answers
38 views

Preparing CliMond data for Maxent

I had been working with BioClim data and that was working in Maxent. I could clip files and realign them etc. Now I have some data from CliMond which is in two formats: Either as text files ...
1
vote
0answers
35 views

Python error in go2streetview plugin

We have the go2streetview plugin installed in QGIS 2.8.6 Wien and when performing a search using this plugin, the following error appeared: An error has occured while executing Python code: ...
1
vote
0answers
53 views

Cannot import name QtTest running unittests for QGIS plugin

I have the following imports in my unittest code: from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import QtCore, QtGui, QtTest When I run my unit test from the command line I get ...
1
vote
0answers
38 views

Geocoding and SRID - can't get desired SRID

I want to geocode a set of addresses with GoogleMaps, store the results in a different SRID in a PostGIS table and then project it in QGIS over a layer with the identical SRID. So far, it has been a ...
1
vote
0answers
20 views

Subset of spatial data causes slow SQL Spatial STIntersects

I've been having an issue were a specific subset of data causes an SQL spatial intersect to run extremely slowly. I am running sets of 1000 points against a subset of polygon layer to be intersected. ...
1
vote
0answers
41 views

Interpolating every X distance along line in shapely

If I have a shapely multiline object that contains many lines whose total length each is 50km (when traced from the origin), and I want to interpolate along the multiline every X meters (let's say ...
1
vote
0answers
38 views

How to access a feature by specific field value using python ogr in an efficient way?

I have one point layer and one polygon layer with a common identifier attribute field called "N", same objects amounts but Feature IDs (FID) are different. I have to iterate on the first one and what ...
1
vote
0answers
73 views

Write stacks of GeoTIFF image to NetCDF by chunk size

I converted GeoTIFF image stacks to NetCDF file with writing data by Index order (layer by layer) (this was a main solution). The problem is, it writes slowly (for 25 images - 1Gb takes 90 seconds). ...
1
vote
0answers
24 views

Use QgsRasterCalculator inside function

I'm relatively new to PyQGIS and I'm building a plugin to perform some calculations between raster layers. I was seeking to use the QgsRasterCalculator for some operations, however, the function that ...
1
vote
0answers
20 views

Python error using Vterrain in qgis

Traceback (most recent call last): File "C:/Users/Haimwant/.qgis2/python/plugins\VTerrain\VTerrain.py", line 409, in run os.spawnl(os.P_NOWAIT, directory + "Enviro", ...
1
vote
0answers
33 views

How to transfer SQL variable back into ArcPy script?

I am trying to teach myself to access sql tables from an ArcPy script as part of a larger QC process. I am fairly certain that I have the sql statement correct (it works in SQL Server, albeit ...
1
vote
0answers
81 views

My QGIS keeps me returning “ascii” errors

First, whenever I open QGIS, the extension "Quickmap Services" returns an error with this tracker: Impossible to load the extension quick_map_services because of an error on calling InitGui() method ...
1
vote
0answers
17 views

Check if raster (part of) lies within a pixel - python/gdal

I have a list of the corner-coordinates of different grid (c1-c4). First i sorted these coordinates to ensure that c1 is the upper left, c2 is the upper right, c3 is the lower left and c4 is the lower ...
1
vote
0answers
50 views

Using row.setValue() function with arcgisscripting?

I'm trying to set column value NULL. I tried different ways to do that, I used CalculateField_management and UpdateCursor but i did not get success. when i used CalculateField_management. It says ...
1
vote
0answers
45 views

Try/Except Statement gives different Results in QGIS Console vs. QGIS Tool

I want my script to do different things depending on whether a particular layer DOES or DOES NOT exist in the Map Layers list. I thought the try: / except: statements would be the best way to achieve ...
1
vote
0answers
27 views

How to use itemChanged signal to update data?

I'm trying to understand the itemChanged signal to be able to update some information. An example of what I'm trying to achieve could be: def setCoordText(): label1.setText(str(label1.x()) + "," ...
1
vote
0answers
36 views

CF convention and GDAL projection

I'm trying to create some NETCDF4 CF compliant files from some code that generates GDAL compatible files. I was wondering whether there is a simple translation from GDAL (or proj4) projection ...
1
vote
0answers
50 views

How can i set layer polygon in center in QGIS using python?

I am trying to set a fixed zoom level whenever I layer is shifting on different polygon. I have coordinates for all the polygons , I need each polygon to be on center with certain zoom level so that ...
1
vote
0answers
37 views

How to change a point of an arrow on Print Composer?

To create an arrow on the Print Composer I've used this: qC = QgsComposition(iface.mapCanvas().mapRenderer()) arw = QgsComposerArrow(QPointF(0, 0),QPointF(10,10),qC) However, I can't find an ...
1
vote
0answers
28 views

python 2 polygon intersection

I have slope values derived from a DEM which I reclassified into NoDATA and vaules which I need. Then I made a polygon from this raster. I need to do intersection or something like that with the ...