bleutner/RStoolbox

state of transition to terra/sf

Closed this issue · 7 comments

Function transition

Transition all RStoolbox spatial functions to use only terra and sf, while maintaining backward compatibility to sp and raster.
See switch_to_terra branch

⚠️ table not yet completely populated

fun ui_raster ui_vector internal_terra internal_sf ui_doc examp return
classifyQA t+r - - r
cloudMask t+r - - r
cloudShadowMask t+r - - r
coregisterImages t+r - r
estimateHaze t+r - -
fCover t+r - ✔️ ✔️ t
ggR t+r - ✔️ - -
ggRGB t+r - ✔️ - -
histMatch t+r - r
mesma t+r - r
normImage t+r - ✔️ r/t
oneHotEncode t+r - ✔️ - t
panSharpen t+r - r
pifMatch t+r - r
radCor t+r - - r
rasterCVA t+r - r
rasterEntropy t+r - r
rasterPCA t+r - r
readRSTBX r - r
rescaleImage t+r - ✔️ - t
rsOpts r - - -
sam t+r - ✔️ - t
saveRSTBX r - - r
spectralIndices t+r - ✔️ - r
stackMeta t+r - ✔️ - r/t
superClass t+r sp+sf ✔️ r + sf
tasseledCap t+r - ✔️ - t
topCor t+r - - r
unsuperClass t+r - ✔️ - r
validateMap t+r sp+sf ✔️ ✔️ -

Test and Example Datasets Transition

Example datasets should be replaced with terra/sf versions.
Test datasets should be retained but complemented with terra/sf versions.

dataset type class
data(lsat) ex RasterBrick
data(srtm) ex RasterLayer
data(rlogo) ex RasterBrick
trainingPoints.rds ex SpatialPointsDF
trainingPolygons.rds ex SpatialPolygonsDF

Design desicions:

  • if input is raster::Raster*, should raster::Raster* or terra::SpatRaster be returned?
  • if input is sp::Spatial*, should sp::Spatial* or sf::st_sf* be returned?

Note:

> ggplot(data=wave, aes(x, y)) + 
+     ggRGB(rlogo, ext=terra::ext(rlogo),ggLayer = TRUE) + 
+     geom_polygon(alpha=0.2) +
+     coord_equal(ylim=c(0,75))
Error in .local(x, y, ...) : Cannot get an Extent object from argument y

> ggplot(data=wave, aes(x, y)) + 
+     ggRGB(rlogo, ext=raster::extent(rlogo),ggLayer = TRUE) + 
+     geom_polygon(alpha=0.2) +
+     coord_equal(ylim=c(0,75))

works.

Table will be updated here as a new contributor, hi, is on-board trying his best to fix some stuff:

fun ui_raster ui_vector internal_terra internal_sf ui_doc examp return backlog
classifyQA t+r - ✔️ ✔️ t
cloudMask t+r - ✔️ ✔️ t
cloudShadowMask t+r - ✔️ ✔️ t
coregisterImages t+r - ✔️ ✔️ t
estimateHaze t+r - ✔️ ✔️ -
fCover t+r - ✔️ ✔️ t
ggR t+r - ✔️ - -
ggRGB t+r - ✔️ - -
histMatch t+r - ✔️ ✔️ t
mesma t+r - ✔️ ✔️ t
normImage t+r - ✔️ - t
oneHotEncode t+r - ✔️ - t
panSharpen t+r - ✔️ ✔️ t
pifMatch t+r - ✔️ ✔️ t
radCor t+r - ✔️ ✔️ t
rasterCVA t+r - ✔️ ✔️ t
rasterEntropy t+r - ✔️ ✔️ t
rasterPCA t+r - ✔️ ✔️ t
readRSTBX t+r - ✔️ ✔️ t+superclass
rescaleImage t+r - ✔️ - t
sam t+r - ✔️ - t
saveRSTBX t+r - ✔️ - t
spectralIndices t+r - ✔️ - t
stackMeta t+r - ✔️ - r/t
superClass t+r sf ✔️ ✔️ t+ sf
tasseledCap t+r - ✔️ - t
topCor t+r - ✔️ - t
unsuperClass t+r - ✔️ - t
validateMap t+r sp+sf ✔️ ✔️ -

Hi Konstantin, great to have you on board! Stoked to see the project be revived. Cheers, Benni

Test and Example Datasets Transition

Example datasets should be replaced with terra/sf versions. Test datasets should be retained but complemented with terra/sf versions.

dataset type class
data(lsat) ex RasterBrick
data(srtm) ex RasterLayer
data(rlogo) ex RasterBrick
trainingPoints.rds ex SpatialPointsDF
trainingPolygons.rds ex SpatialPolygonsDF

Default data was replaced with terra SpatRaster .rds files. They are now called with just typing lsat instead of data(lsat). Also training points and polygons are now save not as sp::Spatial* anymore, but just as a table.

switched to terra in mr #98