The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Create Raster Masks

library(geodl)

When working with geospatial data, it is common for features to be stored as vector data as opposed to categorical raster data. However, deep learning semantic segmentation requires raster-based labels where each unique class is assigned a unique numeric code. The purpose of the makeMasks() function is to generate raster masks from input vector data. It can also generate a copy of the reference raster data and allow for the output mask and image to be cropped relative to a defined extent. The parameters for this function are as follows:

makeMasks(image = "C:/myFiles/data/toChipBinary/image/KY_Saxton_709705_1970_24000_geo.tif",
          features = "C:/myFiles/data/toChipBinary/msks/KY_Saxton_709705_1970_24000_geo.shp",
          crop = TRUE,
          extent = "C:/myFiles/data/toChipBinary/extent/KY_Saxton_709705_1970_24000_geo.shp",
          field = "classvalue",
          background = 0,
          outImage = "C:/myFiles/data/toChipBinary/output/topoOut.tif",
          outMask = "C:/myFiles/data/toChipBinary/output/mskOut.tif",
          mode = "Both")

The plotRGB() function from the terra package can be used to visualized the cropped topographic map since it is an RGB or three-band file. In contrast, the raster mask can be visualized with plot() since it consists of only a single band.

terra::plotRGB(terra::rast("C:/myFiles/data/toChipBinary/output/topoOut.tif"))

Example cropped image

terra::plot(terra::rast("C:/myFiles/data/toChipBinary/output/mskOut.tif"))

Example raster mask

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.