These plugin-based architecture is a way for the user to extend the features of GeoFIS. Each plugin is composed of a user defined R script, launched within the GeoFIS platform and therefore to benefit the whole environment. An entry is added in the “Process” menu for each enabled plugin.
- On Windows the plugins folder is located in “C:\ProgramData\GeoFIS\plugins”. The “C:\ProgramData” folder may be hidden in the file explorer, follow these show hidden files help to display the plugins folder.
- On Linux the plugins folder is located in “/var/lib/geofis/plugins”.
The subfolder “R” includes as many folders as user plugins. Each plugin folder contains the properties file “plugin.properties” and at least 1 R script file.
In order to make the plugin loadable for GeoFIS you have to provide some metadata in the “plugin.properties” file.
plugin.idthe identifier of the plugin (must be unique for all installed plugins) with some name restrictions.
plugin.processthe process name (GeoFIS process menu entry name. The default value is the plugin.id).
plugin.versionthe version of the plugin with the syntax X.Y.Z.
plugin.inputthe spatial input data type (allowed types: “point”, “polygon”, “vector” or “raster”. The default value is “point”. “vector” means “point” or “polygon”).
plugin.outputthe spatial output data type (allowed types: “point”, “polygon”, “input” or “raster”. The default value is “input”. “input” means the same type as input data).
- Optional metadata:
plugin.descriptiona description for the plugin.
plugin.providerthe name of the plugin provider / author.
plugin.packagesthe list of R packages (comma separated) needed for the plugin.
plugin.licensethe license of the plugin.
The main plugin R script can accepts some user parameters. Each parameter is described in the “plugin.properties” file by properties
The parameter property syntax is:
plugin.parameter'n' = 'name' 'type' [range] [layer name]
nis the number of the parameter (start at 1).
nameis the parameter name with some name restrictions.
typeis the parameter type. Allowed type are: “text”, “integer”, “real”, “layer” or “attribute”. The default type is “text”.
- The “layer” type allows the user to load an additional layer in the plugin, for example a border or additional data. Supported layers are Shapefile or raster GeoTIFF.
- The “attribute” type allows the user to select an attribute (or band for raster) in a layer. The user can specify a “layer name” (the name of a “layer” parameter) or “input” for the input layer. The default is “input”.
rangeis optional and only used for “integer” or “real” parameter type. The range is used to control the input parameter validity. No control if the range is not specified.
layer nameis optional and only used for “attribute” parameter type. This layer name refers to an existing “layer” parameter. The default value is “input”.
The range syntax is: lower upper endpoints comma separated enclosed with brackets / parentheses for inclusive / exclusive values.
- For example [0, 10] for a range with included enpoints, (0, 10) for a range with excluded enpoints.
- Exclusions can be mixed (0, 10] or [0, 10).
- Real values are allowed with dot decimal separator [0.5, 1.5].
- Infinite range if endpoint is missed: [0,) for at least 0. (,10] for at most 10. (0,) for greater than 0. (,10) for lesser than 10.
The main plugin R script can returns some results. These results will be displayed in the GeoFIS plugin window. Each result is described in the “plugin.properties” file by properties
The result property syntax is:
plugin.result'n' = 'name'
nis the number of the result (start at 1).
nameis the result name with some name restrictions.
plugin.result name is used as R variable, a valid R variable name consists of letters, numbers, the dot and underline characters. The name must start with a letter or a dot not followed by a number.
Reserved words “input”, “text”, “integer”, “real”, “attribute” and “layer” are not allowed for parameter name.
The main R script called “plugin-class.R” contains the main R class of the plugin (based on R6 class). The custom R code can be splitted in multiple R files. All R files in the plugin folder will be launched by GeoFIS.
- The name of this class must be prefixed with the
- Your code must be inserted between the “start / end custom code” comments of the perform() method.
- The field “private$.input” contains spatial input data selected from GeoFIS process menu, converted to object of the sp package:
- The field “private$.output” must contains the result spatial data of the plugin, displayed in GeoFIS as the output layer. Supported objects are:
- The name of required R packages for the plugin must be supplied in the
- The parameters are accessible within the script by their name using the syntax “self$name”. As the R6 class is not locked “lock_objects = FALSE”, the plugin parameters are added dynamically to the class, without the need to explicitly add the parameter as field of the class.
- The “layer” parameters are converted to the same R object as the input data.
- The “attribute” parameter is converted to R character.
2 example plugins are provided:
- template: the template to use to make a new plugin (do nothing by default)
- sample: this plugin, designed to show the various possibilities that are offered to plugins, takes a subset of the input data and returns it as an output layer. The size of the subset is an input parameter called “sample_percent”, a percentage of the whole size.
To make a new plugin:
- copy / paste the template folder to a folder with the name of your plugin.
- edit the metadata of your plugin in the file “plugin.properties”.
- edit the main class “plugin-class.R”:
- rename the class with the prefix
- insert your code inside the perform() method.
- rename the class with the prefix
- restart GeoFIS
See the plugin example sample.
Enable / Disable plugins
You can enable or disable any plugin by editing the file “disabled.txt” in the root of the plugins folder. All
plugin.id added in these file will be ignored. The others are available at the next start of GeoFIS.