Plugins

Insensa-GIS is built around a plugin system. Plugins extend the core with new file formats, statistical operations, viewers and complete analytical workflows. They come in two flavours: Java plugins and R plugins.

Two ways to write a plugin

Java plugin

Implement IPluginExec and friends, register the plugin in extensions.xml, package as a JAR. Best for tight integration with the domain model and for performance-critical loops.

R plugin

Write an R script, declare the settings UI with insensa::uiAddBoolean / uiAddInputNumeric / etc. — the Swing dialog is generated for free. Read inputs with getVar, send outputs back with addVar.

Available plugins

The plugins below are maintained as part of the official collection at insensa-gis-plugins.

Java plugins

  • ASCIIExporter FileExporter

    Export raster files as ASCII with the geographic information saved in XML.

  • CumulativeFunction OptionFileChanger

    Calculates a generalised density raster by assigning the mean value of surrounding pixels. Repeating increases generalisation.

  • JenksOptimalBreaks Option

    Classification using Jenks natural breaks.

  • ScatterPlotViewer ImageViewer

    Display scatterplots between two raster files. Drag & drop inputs, optional linear trendline and formula.

  • ShapeFileViewer Viewer

    Render vector shape files.

  • ShapeToGeoTiffOption OptionFileChanger

    Rasterise shape files into GeoTIFFs.

  • ViewerHtmlSortedDataTable HtmlViewer

    Combine information from different functions and files in a sorted HTML table. Save as HTML or CSV.

R plugins

  • r-climate-import Import

    Import Worldclim climate data as GeoTIFF directly into your Insensa workspace.

  • r-gbif-occurrence-data Import

    Pull occurrence records for a species from GBIF, ready to feed into species-distribution workflows.

  • r-maxent-sdm Connection

    Fit a MaxEnt species-distribution model on raster predictors and produce a suitability map. Pairs with r-climate-import and r-gbif-occurrence-data for an end-to-end SDM pipeline.

  • r-crop-raster Connection

    Crop a GeoTIFF to a given extent.

  • ROpenStreetmap Viewer

    Plot OpenStreetMap tiles as a base layer.

Write your own plugin

The fastest way to ship a custom analysis is an R plugin — a single script with a few uiAdd* declarations is enough.

library(insensa)

insensa::uiAddInputNumeric("digits",
                           displayText  = "Decimal digits",
                           defaultValue = 3,
                           global       = TRUE)
insensa::uiAddBoolean("includeNA",
                      displayText  = "Count NA",
                      defaultValue = FALSE)

if (!insensa::isActive()) {
  rasterFile <- "/path/to/test.tif"
}

insensa::iget("raster", attach = TRUE)
r <- raster(rasterFile)

digits    <- insensa::getVar("digits",    default = 3)
includeNA <- insensa::getVar("includeNA", default = FALSE)

insensa::addVar(round(cellStats(r, "mean", na.rm = !includeNA), digits),
                "mean_value")

The R helper package insensa lives on Bitbucket at dbiber/r-insensa. A CRAN release is planned (the package itself is ready) — until then, install with devtools::install_bitbucket("dbiber/r-insensa").

For Java plugins, see the development guide in the plugin repository.