Questions tagged [ppygis]

PPyGIS is an extension for Psycopg which adds support for PostGIS geometry objects

Filter by
Sorted by
Tagged with
2 votes
1 answer
52 views

Running PyQGIS without using the GUI

I found this topic and it is exactly what I want to do. As @casta2k in 2015 I am running MacOS. So I follow the step and that is what I get : >>> import sys >>> import os >>>...
user avatar
  • 115
0 votes
2 answers
79 views

Loading specific layer by its name from GeoPackage

How can I load a specific layer by its name from a GeoPackage into the project. I tried the graphical model designer, but it always loads a layer from the geopackage and labels it with my layer name (...
user avatar
  • 159
1 vote
0 answers
38 views

Qgs Raster Calculation [closed]

I am trying to make product of five raster layer, but not working. if result: lyr1 = QgsRasterLayer(self.dlg.comboBox.currentText()) lyr2 = QgsRasterLayer(self.dlg.comboBox_2....
user avatar
1 vote
1 answer
79 views

PyQGIS: Querying PostGIS Table

I am trying to run a query on a PostGIS table via PyQGIS (QGIS3.16-Hannover installed on an Ubuntu 20.04LTS Desktop). Everything works fine if I SELECT ALL FIELDS using the wildcard pattern (*) ...
user avatar
1 vote
2 answers
165 views

How to create when possible a rectangle in polygons with holes [duplicate]

I did not find a similar question on this site. Is there a way to automatically create a rectangular polygon of 500 square meters inside another polygon with rings using QGIS? (I have 28,000 polygons ...
user avatar
  • 643
0 votes
0 answers
22 views

QGIS: Populate a QTableWidget in a custom-ui-form by PostgreSQL data

I want to query Objects from a QGIS-Layer with the Object-Select-Tool. The Data should be displayed in a custom gui form "dvl_flaecheninfo_v01.ui", i.a. in a 1:n-connectet QtableWidget like ...
user avatar
2 votes
2 answers
85 views

Building a table from for loop values in QGIS

I am calculating the volume of a few lakes at 1 cm intervals. In QGIS I am using the raster surface volume tool and I am trying to iterate the process in a for loop so that I don't have to manually ...
user avatar
  • 43
2 votes
0 answers
97 views

Making QGIS GUI responsive while adding multiple layers in Plugin

I have a tool button that add many layers from python code (WFS, PostgreSQL, ...), about 50 layers (30s to load) in QGIS. During the process the application seem to be crashed "not responding&...
user avatar
  • 463
-2 votes
2 answers
114 views

PyGis: How to enable and disable raster layers with Python? [closed]

How to enable and disable raster layers with Python? It should be a solution without selecting the layers before turn them off or on. I could find some code snippets for vector layers, but not for ...
user avatar
2 votes
1 answer
905 views

Exporting layers as CSV-files using PyQGIS

I am trying to export several layers as CSV-files since I need to analyze them in another software. However, I cannot get my code to work. I am new to Python. Currently working in QGis 3.10.9. I would ...
user avatar
  • 179
2 votes
0 answers
236 views

Networkx Graph from two separate shapefiles

I have two shapefiles that represent a railway network. The first shapefile (tracks.shp) contains LineStrings representing tracks The second shapefile (crossings.shp) contains Points representing ...
user avatar
2 votes
1 answer
2k views

Using OpenCV function in PyQGIS - Module not found

I would like to write a code using the OpenCV function cv2.bitwise_and, and run it in the Python console on QGIS. To do so, I start my code with import cv2. QGIS is returning the following error : ...
user avatar
4 votes
3 answers
376 views

Copy feature between layers with PyQGIS [duplicate]

I am new in PyQGIS and am having trouble programming how to copy features between layers. Goal: from a robust layer (with more fields) copy its features to a 'simple' version layer. from qgis.core ...
user avatar
3 votes
0 answers
1k views

Getting pixel size without opening raster using Python

I want to get the pixel size (resolution) of a raster without opening up the raster in gdal. I currently have my script opening the raster in GDAL using gdal.Open() and getting the resolution that way....
user avatar
  • 39
3 votes
1 answer
216 views

QGIS 3-->Python-Code from graphic modeler doesn't work

I run a model with an if-condition with sucess. After exporting the code the scirpt gives me an error: "Unable to execute algorithm Field name is not set. Please enter a field name". the code-snippt ...
user avatar
  • 61
1 vote
0 answers
37 views

Creating datasets from .tiff and vectors [closed]

We are group of three masters students at University of Oslo, we're writing a research article this semester. We are proposing a global UAV (drone) localization system by Monte-Carlo Localization and ...
user avatar
1 vote
1 answer
38 views

Aggregating the attributes from nearby grids and assigning it to the parent grid in a fishnet

I have 700,000 grids generated to cover an administrative area. I want to calculate the sum of an attribute in its neighboring grids till 2nd order and assign it to each grid. To do so I have ...
user avatar
1 vote
0 answers
35 views

Batch Saving Raster DTm and choosing type in QGIS 2.18

Follow on question from the following Previous question batch saving 10m DTM layers using python console I would now like to set the output of my Raster .tif files to Float32 as by default the .asc ...
user avatar
1 vote
1 answer
188 views

QGIS 2.18: Filter line-layer by QgsExpression

I have a line layer on which I want to run a filter within a python script. I am trying to achieve this via QgsExpression and QgsFeatureRequest. Below you see the same filter that I want to apply in ...
user avatar
2 votes
2 answers
917 views

Write to QGIS python console from plugin with sys.stdout

From my own QGIS plugin, I want to print text to the python console (see motivation below). Most simply, I use import sys sys.stdout.write('Outputtext') And get: AttributeError: 'NoneType' ...
user avatar
1 vote
1 answer
311 views

pygis zoom to selected layer

I selected the layer I want to zoom in and I can actually zoom in using the python console that Qgis provides using iface.zoomToActiveLayer() but if I do the same in my code, is like that line is ...
user avatar
  • 355
1 vote
1 answer
145 views

QGIS python script crashed with minidump written to C

I have written a python script which has two input vector layers (one point-layer and one line-layer). The outpout is another line-layer. But when I try too set the geometry for the new edge, the ...
user avatar
2 votes
1 answer
387 views

Joining attributes after selecting one polygon which intersects another using geopandas?

To select the polygons which overlap other layer's polygons, I came up with this code based on what I found on this site: import geopandas as gpd import fiona import os import sys # Get the current ...
user avatar
  • 195
2 votes
0 answers
125 views

Insert point layer as input for GRASS viewshed in QGIS 3.2 modeler

I’m building a QGIS (3.2 Bonn) tool for my colleagues using graphical modeler. The tool should get 3 inputs: DEM raster layer, vector layer of points, vector layer of a point of interest (POI). The ...
user avatar
  • 1,565
2 votes
1 answer
1k views

Running Powershell Script from QGIS Actions or Python Console

Is anyone able to explain how the Windows/Open Actions work? And also the python console? I have a powerscript .ps1 file I was wanting to launch from either of these options and it just doesn't seem ...
user avatar
  • 21
2 votes
2 answers
912 views

Creating a portable map package file folder

I am searching for an expression or some assistance in changing filepaths and links to photos within attributes to relative paths. I have used QConsolidate to create a folder with all the files and ...
user avatar
2 votes
0 answers
24 views

pyqgis composer legend error(no print)

i want to use composer in pyqgis standalone script to create some easy mas using one raster. my output image is correct i have the image but that code cant print show the legend in the map, any ...
user avatar
  • 1,079
3 votes
2 answers
278 views

Rectangle Buffer (with dimensions given in metres) around Points on map (lat long). Using QGIS 3.0

I have points on a map of the globe given with lat|long coordinates. I want to create a rectangular buffer around each one, but I want to be able to set the dimension of this buffer in metres. The ...
user avatar
  • 315
0 votes
1 answer
103 views

Analysing and mapping intersection of layers with one layer with overlapping Polygons

I have one layer (a_layer) with approx 400 overlapping polygons and no more data as the fid. I want to analyse how many countys (b_layer) are coverd by each polygon of tha a_layer. I was thinking to ...
user avatar
  • 346
1 vote
1 answer
49 views

Fill or inserting new field based on comparison of two other field

I have a layer Network with two different columns Route and section I need a query or function that compare Route rows , and section rows, and create or rather fill the new_field with this ...
user avatar
  • 167
2 votes
1 answer
2k views

How to batch export rasters as GeoTIFF with new CRS?

I need some help concerning the exporting of a large batch of raster-files (mostly SID-types) as GeoTIFFs in a reference system (WGS 84) that is different from the one in which the original files were ...
user avatar
  • 59
0 votes
1 answer
139 views

standalone script using grass7:v.clean gives erro

I am writing a standalone script using QGIS processing plugins. everything works but after adding a new command it gives me some errors. The command is as folloing: processing.runalg("grass7:v.clean",...
user avatar
4 votes
1 answer
6k views

MGRS grid in QGIS

I'm trying to generate a Military Grid Reference System (MGRS) grid on QGIS (with polygons in scale of 100m), such a grid will be similar to when importing a grid made of shapefiles (such as http://...
user avatar
  • 41
2 votes
1 answer
246 views

QGIS treatment modeler to python script

I'm trying to make a little tool who do a concave hull, and calculate its surface in a new field. I'm not a python pro, so I began with treatment modeler like this : It works very well ! But I have ...
user avatar
  • 1,416
1 vote
0 answers
179 views

Keep dialog displayed while processing

I'm working on a plug-in for QGIS and I'm a bit stuck on a problem with my dialog (realized on Qt Designer). Indeed, I added a progression bar wich seems to work, but I can't really check this ...
user avatar
  • 11
1 vote
0 answers
30 views

Append object from another layer to the new layer through form (drop-down list)

I'm trying to get to know is it possible to append object from another layer to the new layer through form (drop-down list)? Do I need to create an application? If yes please tell me what language ...
user avatar
  • 83
1 vote
1 answer
2k views

Get a point value with psycopg2 and PPyGIS

I'm trying to setup a basic working postgis setup with python ppygis package. >>> import psycopg2 >>> import ppygis >>> connection = psycopg2.connect(database='spre', user='...
user avatar