Re: [Qgis-user] [pyqgis] create new raster

2023-05-11 Per discussione andrea antonello via QGIS-User
> > The enumeration list of the OUTPUT_TYPE parameter values of the > native:createconstantrasterlayer processing algorithm (like for other > algorithms) is specified in the documentation of such algorithm at > >

Re: [Qgis-user] [pyqgis] create new raster

2023-05-10 Per discussione andrea antonello via QGIS-User
me findings on the reaster writing, but that will make more sense in a different dedicated thread. Cheers, Andrea > > Am 2023-05-09 16:23, schrieb andrea antonello via QGIS-User: > >> What do you mean by "new raster"? What is supposed to be in it and > >> how should i

Re: [Qgis-user] [pyqgis] create new raster

2023-05-09 Per discussione andrea antonello via QGIS-User
s, Andrea If you want to base it on an existing raster, best use a raster calculator > to create a plain copy. > > Cheers, Hannes > Am 09.05.23 um 08:28 schrieb andrea antonello via QGIS-User: > > Hello, > I am trying to find out the best workflow to create a new raster. >

Re: [Qgis-user] [pyqgis] create new raster

2023-05-09 Per discussione andrea antonello via QGIS-User
ic Works > > *Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36 * > Jonathan Swift Street, Trim, Co Meath, C15 NX36 > —— > M +353 87 688 5964 T +353 46 942 2409 > https://https://gov.ie/opw <https://www.opw.ie> > > —— > Email Disclaimer: > https://www.go

[Qgis-user] [pyqgis] create new raster

2023-05-09 Per discussione andrea antonello via QGIS-User
Hello, I am trying to find out the best workflow to create a new raster. As an example I take an existing elevation model raster and loop over it to set values between 1500 and 2000 to novalue and write the result to a new raster. This is the only way I found to do so: # create new raster with

Re: [Qgis-user] [pyqgis] looping through a raster (andrea antonello)

2023-05-05 Per discussione andrea antonello via QGIS-User
Hi Doug, Why not call GRASS r.series through the python interface, average the stack > of rasters there, then select the point value from the result. It's a bit > brute force, but when I have used r.series directly in GRASS with hundreds > of large rasters at a time, there was fairly low memory

Re: [Qgis-user] [pyqgis] looping through a raster

2023-05-05 Per discussione andrea antonello via QGIS-User
I apologize for my previous badly readable code snippet. Here a better version with a dummy example: # simple raster stats cols = dtmLayer.width(); rows = dtmLayer.height(); minV = 1000 maxV = 0 count = 0 sum = 0 transformType = QgsRasterDataProvider.TransformType.TransformImageToLayer for

[Qgis-user] [pyqgis] looping through a raster

2023-05-05 Per discussione andrea antonello via QGIS-User
Hello, I am trying to understand how to easily loop through the values of a raster layer using pyqgis. In the docs I see the sample and identify methods of the dataprovider, but can't spot anything that uses rows/cols as a way of iteration. Is the most efficient way to use transformCoordinates to

Re: [Qgis-user] Pyqgis how to append existing gpkg layer

2023-04-26 Per discussione andrea antonello via QGIS-User
> See prior messages in this thread: > https://lists.osgeo.org/pipermail/qgis-user/2023-April/052855.html > ah, sorry, I missed that part somehow. Thanks, cheers, Andrea > > Regards, > > Germán > > > El mié, 26 abr 2023 a las 9:11, andrea antonello via QGIS-User (&

Re: [Qgis-user] Pyqgis how to append existing gpkg layer

2023-04-26 Per discussione andrea antonello via QGIS-User
Hi, from what I saw in the docs, you should be able to append to layers with the filewriter option AppendToLayerNoNewFields? The CreateOrOverwriteLayer overwrites the layer completely. Cheers, Andrea On Wed, Apr 26, 2023 at 2:58 PM Anne B. Nilsen via QGIS-User < qgis-user@lists.osgeo.org>

Re: [Qgis-user] [pyqgis] setSubsetXXX for intersection?

2023-04-12 Per discussione andrea antonello via QGIS-User
.com/WhereGroup/spatial_filter/blob/e77abb9830f5d46073239b8e7376c52a69046223/filters.py#L45 > > As of now, the plugin supports it for PostGIS, GPKG and Spatialite layers > . It probably is easy to adapt for other geospatial databases too. > > Cheers, Hannes > Am 12.04.23 um 09:35 sc

[Qgis-user] [pyqgis] setSubsetXXX for intersection?

2023-04-12 Per discussione andrea antonello via QGIS-User
Hello, I was wondering if in pyqgis there is a way to load a layer to show only features that intersect a certain geometry. I see the setSubsetString for sql like queries, but no way to do this with geometries. Similar to this (but only applied to iterations using getFeatures), I was wondering if

[Qgis-user] pyqgis - external module issues

2023-03-29 Per discussione andrea antonello via QGIS-User
Hello, I am trying to work in the scripting editor with two modules. Assume I have a main.py script and a mylibrary.py in the same folder. In the system settings I made sure to add the said folder to the PYTHONPATH in prepend mode in order to be able to find the mylibrary upon import. This is