[QGIS-Developer] Influencing order of Loaded Processing FeatureSinks

2021-11-24 Thread Richard Duivenvoorde
Hi Devs,

I recently used the CheckValidity algorithm to check some strange shapefile:

https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/qgis/CheckValidity.py

It generates (if you let them load) three layers: 
- Valid output (features)
- Invalid output
- Error output (points)

But... in that order so after every validation you have to pull (at least) de 
Error output on top to see the invalid points.

So I thought to try to change the order in the python code, but (to me) it 
looked I could not influence that.

Am I right? 
I tried both changing the order of the parameter and featuresink creation, I 
even tried to rename the layers (as in prepending abc or 123 to it).
Or am I missing something?

Another feature I would like to see: show the actual count (of at least the 
invalid features and the error points), but same thing: processing is indeed 
loosely/not coupled to QGIS-gui?
But because these core-algorithms are part of gui/menu's, I'm hoping we can 
maybe make this better?

Any hint appreciated.

Regards,

Richard Duivenvoorde
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Access QgsVectorLayer from child algorithm

2021-11-24 Thread Simon Gröchenig

Yes, that is the method I am looking for. Thank you, Etienne.

I am still curious why the output is different depending on the 
isChildAlgorithm parameter??


Simon


Am 24.11.2021 um 12:50 schrieb Etienne Trimaille:

This might help you ?
QgsProcessingUtils::mapLayerFromString()
https://qgis.org/api/classQgsProcessingUtils.html#aa1c2360e52d2ed8100faf02a35125b17


Le mer. 24 nov. 2021 à 11:19, Simon Gröchenig 
 a écrit :


Hi developers,

I am developing a Python processing algorithm with some child
algorithms. I am struggling to find a way to access a child
algorithm's output vector layer. I want to use
isChildAlgorithm=True in order to correctly set the feedback progress.

* If I use processing.run(...) with setting the parameter
isChildAlgorithm to False (= default), the vector layer (via sink)
is returned as a QgsVectorLayer.
* If I set isChildAlgorithm to True, only the dest_id is returned
as a string. I did not find a solution on how I retrieve the
corresponding QgsVectorLayer.
* Is it intentional that the vector layer is returned as
QgsVectorLayer or str (dest_id), depending on the isChildAlgorithm
parameter?
* How can I access output QgsVectorLayer from a child algorithm?

This is a minimum example where you can modify the
is_child_algorithm parameter:

parameters = {
    'INPUT': QgsVectorLayer('Point?crs=epsg:31258', 'locations',
"memory"),
    'DISTANCE': 10,
    'OUTPUT': 'TEMPORARY_OUTPUT'
}
result = processing.run("native:buffer", parameters,
is_child_algorithm=False )
vector_layer = result['OUTPUT']
print(str(type(vector_layer)))

Best regards
Simon

-- 
Simon Gröchenig MSc

MTA - Mobility & Transport Analytics

Salzburg Research Forschungsgesellschaft mbH
Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
T: +43.662.2288-314
simon.groeche...@salzburgresearch.at
http://www.salzburgresearch.at

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


--
Simon Gröchenig MSc
MTA - Mobility & Transport Analytics

Salzburg Research Forschungsgesellschaft mbH
Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
T: +43.662.2288-314
simon.groeche...@salzburgresearch.at
http://www.salzburgresearch.at
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Minimal docker image for qgis_process/processing

2021-11-24 Thread David Marteau


FYI, the image at https://hub.docker.com/r/3liz/qgis-platform is 
perfectly suited for using processing with python


(we use it as base image for our wps/processing server)


Le 24/11/2021 à 18:21, Denis Rouzaud a écrit :

I didn't pay attention but replied privately to David.

After discussing, it appears that qgis_process is only available under 
the qgis package.

It would make sense to make it available under it own package, no?

Le mer. 24 nov. 2021 à 09:58, David Marteau  a écrit :

Hi Nyall

I don't know if this is what you are seeking for but you will find at
https://hub.docker.com/r/3liz/qgis-platform a simple
image that embed the official version (release/ltr) of Qgis
library (no
desktop support).

That image do nothing except having a Qgis install. We use it as a
base
image for all other docker images that require Qgis libraries.

Sincerely

David

Le 24/11/2021 à 07:31, Nyall Dawson a écrit :
> Hi lists,
>
> Is anyone aware of any minimal QGIS dockers which are designed just
> for using the processing tools (either via Python or qgis_process)?
>
> (Ideally I'm hoping to find one which has no
> GUI/server/application/etc components, but does have all the
desirable
> libraries for a full-featured processing experience!)
>
> Nyall
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Minimal docker image for qgis_process/processing

2021-11-24 Thread Denis Rouzaud
I didn't pay attention but replied privately to David.

After discussing, it appears that qgis_process is only available under the
qgis package.
It would make sense to make it available under it own package, no?

Le mer. 24 nov. 2021 à 09:58, David Marteau  a écrit :

> Hi Nyall
>
> I don't know if this is what you are seeking for but you will find at
> https://hub.docker.com/r/3liz/qgis-platform a simple
> image that embed the official version (release/ltr) of Qgis library (no
> desktop support).
>
> That image do nothing except having a Qgis install. We use it as a base
> image for all other docker images that require Qgis libraries.
>
> Sincerely
>
> David
>
> Le 24/11/2021 à 07:31, Nyall Dawson a écrit :
> > Hi lists,
> >
> > Is anyone aware of any minimal QGIS dockers which are designed just
> > for using the processing tools (either via Python or qgis_process)?
> >
> > (Ideally I'm hoping to find one which has no
> > GUI/server/application/etc components, but does have all the desirable
> > libraries for a full-featured processing experience!)
> >
> > Nyall
> > ___
> > QGIS-Developer mailing list
> > QGIS-Developer@lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Access QgsVectorLayer from child algorithm

2021-11-24 Thread Etienne Trimaille
This might help you ?
QgsProcessingUtils::mapLayerFromString()
https://qgis.org/api/classQgsProcessingUtils.html#aa1c2360e52d2ed8100faf02a35125b17


Le mer. 24 nov. 2021 à 11:19, Simon Gröchenig <
simon.groeche...@salzburgresearch.at> a écrit :

> Hi developers,
>
> I am developing a Python processing algorithm with some child algorithms.
> I am struggling to find a way to access a child algorithm's output vector
> layer. I want to use isChildAlgorithm=True in order to correctly set the
> feedback progress.
>
> * If I use processing.run(...) with setting the parameter isChildAlgorithm
> to False (= default), the vector layer (via sink) is returned as a
> QgsVectorLayer.
> * If I set isChildAlgorithm to True, only the dest_id is returned as a
> string. I did not find a solution on how I retrieve the corresponding
> QgsVectorLayer.
> * Is it intentional that the vector layer is returned as QgsVectorLayer or
> str (dest_id), depending on the isChildAlgorithm parameter?
> * How can I access output QgsVectorLayer from a child algorithm?
>
> This is a minimum example where you can modify the is_child_algorithm
> parameter:
>
> parameters = {
> 'INPUT': QgsVectorLayer('Point?crs=epsg:31258', 'locations', "memory"),
> 'DISTANCE': 10,
> 'OUTPUT': 'TEMPORARY_OUTPUT'
> }
> result = processing.run("native:buffer", parameters,
> is_child_algorithm=False )
> vector_layer = result['OUTPUT']
> print(str(type(vector_layer)))
>
> Best regards
> Simon
>
> --
> Simon Gröchenig MSc
> MTA - Mobility & Transport Analytics
>
> Salzburg Research Forschungsgesellschaft mbH
> Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
> T: 
> +43.662.2288-314simon.groechenig@salzburgresearch.athttp://www.salzburgresearch.at
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] Access QgsVectorLayer from child algorithm

2021-11-24 Thread Simon Gröchenig

Hi developers,

I am developing a Python processing algorithm with some child 
algorithms. I am struggling to find a way to access a child algorithm's 
output vector layer. I want to use isChildAlgorithm=True in order to 
correctly set the feedback progress.


* If I use processing.run(...) with setting the parameter 
isChildAlgorithm to False (= default), the vector layer (via sink) is 
returned as a QgsVectorLayer.
* If I set isChildAlgorithm to True, only the dest_id is returned as a 
string. I did not find a solution on how I retrieve the corresponding 
QgsVectorLayer.
* Is it intentional that the vector layer is returned as QgsVectorLayer 
or str (dest_id), depending on the isChildAlgorithm parameter?

* How can I access output QgsVectorLayer from a child algorithm?

This is a minimum example where you can modify the is_child_algorithm 
parameter:


parameters = {
    'INPUT': QgsVectorLayer('Point?crs=epsg:31258', 'locations', "memory"),
    'DISTANCE': 10,
    'OUTPUT': 'TEMPORARY_OUTPUT'
}
result = processing.run("native:buffer", parameters, 
is_child_algorithm=False )

vector_layer = result['OUTPUT']
print(str(type(vector_layer)))

Best regards
Simon

--
Simon Gröchenig MSc
MTA - Mobility & Transport Analytics

Salzburg Research Forschungsgesellschaft mbH
Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
T: +43.662.2288-314
simon.groeche...@salzburgresearch.at
http://www.salzburgresearch.at
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Minimal docker image for qgis_process/processing

2021-11-24 Thread Matthias Kuhn
Hi Nyall,

I prepared a qgis image based on alpine linux a couple of months back but
never released it to public.
It's super slim and builds QGIS from source during docker build.
If there is interest, I can revive that.

Cheers
Matthias


On Wed, Nov 24, 2021 at 7:31 AM Nyall Dawson  wrote:

> Hi lists,
>
> Is anyone aware of any minimal QGIS dockers which are designed just
> for using the processing tools (either via Python or qgis_process)?
>
> (Ideally I'm hoping to find one which has no
> GUI/server/application/etc components, but does have all the desirable
> libraries for a full-featured processing experience!)
>
> Nyall
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] Minimal docker image for qgis_process/processing

2021-11-24 Thread David Marteau

Hi Nyall

I don't know if this is what you are seeking for but you will find at 
https://hub.docker.com/r/3liz/qgis-platform a simple
image that embed the official version (release/ltr) of Qgis library (no 
desktop support).


That image do nothing except having a Qgis install. We use it as a base 
image for all other docker images that require Qgis libraries.


Sincerely

David

Le 24/11/2021 à 07:31, Nyall Dawson a écrit :

Hi lists,

Is anyone aware of any minimal QGIS dockers which are designed just
for using the processing tools (either via Python or qgis_process)?

(Ideally I'm hoping to find one which has no
GUI/server/application/etc components, but does have all the desirable
libraries for a full-featured processing experience!)

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer