[Qgis-developer] Basic Processing plugin questions

Tom Chadwin tom.chadwin at nnpa.org.uk
Wed Apr 5 06:02:29 PDT 2017


volaya wrote
>> 2. Can a Processing plugin take *any* layer, rather than having to choose
>> between raster and vector?
> 
> No, not at the moment. The multiple input can have several layer types
> at once, but single layers can't

Can it? If I add a multiple input, the dropdown only contains my project's
point (vector) layers. If I explicitly set the datatype for the
ParameterMultipleInput to -1 (see
https://github.com/qgis/QGIS/blob/master/python/plugins/processing/tools/dataobjects.py#L53),
the dropdown correctly contains all my vector layers (point, line, and
poly).

What I was hoping for is to able to take *any* layer - vector or raster.
However, datatype ALL_TYPES (defined as [-1] at
https://github.com/qgis/QGIS/blob/master/python/plugins/processing/tools/dataobjects.py#L51)
fails, as it won't accept a list:

File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\core\parameters.py",
line 362, in __init__
			    self.datatype = int(float(datatype))
			TypeError: float() argument must be a string or a number

I'm clearly not quite understanding this yet. Can anyone help?

Thanks

Tom



-----
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Basic-Processing-plugin-questions-tp5315610p5315896.html
Sent from the QGIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list