Questions tagged [ppygis]

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

Filter by
Sorted by
Tagged with
2
votes
2answers
40 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 ...
2
votes
0answers
60 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&...
-2
votes
2answers
46 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 ...
2
votes
1answer
61 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 ...
2
votes
0answers
74 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 ...
2
votes
1answer
491 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 : ...
0
votes
0answers
53 views

Bit Plane Slicing

Until now, I used Matlab (Octave actually) to perform a bit plane slicing using the function bitget. I am only intersted on having the most significant bits of an 8-bits grayscale image, i.e. the 7th ...
4
votes
3answers
102 views

Copy feature between layers with PyQGIS

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 ...
3
votes
0answers
188 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....
2
votes
1answer
121 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 ...
1
vote
0answers
28 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 ...
1
vote
1answer
32 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 ...
1
vote
0answers
28 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 ...
0
votes
2answers
453 views

QGIS how to fill the fields instantly and automatically when creating an entity

I have a polygon layer, I want to fill the fields automatically each creation of a polygon. Knowing that there is a spatial relationship (intersection, contain ...) between my polygons and other ...
1
vote
1answer
115 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 ...
2
votes
2answers
475 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' ...
1
vote
1answer
203 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 ...
1
vote
1answer
90 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 ...
1
vote
1answer
136 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 ...
2
votes
0answers
97 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 ...
2
votes
1answer
847 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 ...
2
votes
2answers
762 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 ...
1
vote
0answers
19 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 ...
3
votes
2answers
198 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 ...
0
votes
1answer
66 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 ...
1
vote
1answer
45 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 ...
2
votes
1answer
1k 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 ...
1
vote
1answer
7k views

Cannot access coords property of LineString in GeoDataFrame

How can I access the coords property of a LineString in GeoDataFrames? I can access other properties, such as area, length, etc, as documented in the Shapely documentation. See reproducible example ...
0
votes
1answer
125 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",...
4
votes
1answer
3k 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://...
2
votes
1answer
242 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 ...
1
vote
0answers
114 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 ...
1
vote
0answers
25 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 ...
1
vote
1answer
1k 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='...