Is there any way to force input parameters (e.g. data provider, geometry type, field type) in processing scripts?
-
What have you attempted thus far?whyzar– whyzar2017年01月03日 16:22:07 +00:00Commented Jan 3, 2017 at 16:22
-
are you familiar with the Graphical Modeller? Or do you need fields to be made mandatory/required outside of the modeller, e.g. running a single algorithm from a Python script?Steven Kay– Steven Kay2017年01月03日 21:28:07 +00:00Commented Jan 3, 2017 at 21:28
1 Answer 1
For processing scripts, I don't think it is currently possible to filter out a layer's data provider specifically for PostGIS layers. Looking at the parameters.py file for the processing framework, it seems that you can only specify the following for all loaded shapefiles:
- Geometry type: (point, line or polygon)
- Field type: (number, string)
So currently, you could use something like:
##Input table=vector point
##Distance field=field number Input table
You could try and edit the file to include a PostGIS parameter (not sure how much editing is required) which you can find in your QGIS directory. E.g.:
C:/Program Files/QGIS 2.18.2/apps/qgis/python/plugins/processing/core/parameters.py