north-road / qgis-processing-r

QGIS Processing R Provider Plugin
https://north-road.github.io/qgis-processing-r/
GNU General Public License v3.0
63 stars 14 forks source link

QGIS Expressions for R scripts #101

Closed JanCaha closed 2 years ago

JanCaha commented 2 years ago

Adds ability to add variables to R scripts based on QGIS expressions.

The expressions are catched before creating a parameter (to avoid exposure to user), stored and then evaluated and added back to R script. This required changes RTemplates class to avoid code duplication.

Works for QGIS Expressions that output string, integer, float, QDatetime, QDate, QTime, QgsGeometry and list containing these types.

All tests seem to to working (altough it took some time to make it so and make pylint happy).

nyalldawson commented 2 years ago

Looks good! Just the minor point about using .format instead of f strings for now