fdetsch / MODIS

Download and processing framework for MODIS imagery. The package provides automated access to the global online data archives LP DAAC, LAADS and NSIDC as well as processing capabilities such as file conversion, mosaicking, subsetting and time series.
Other
58 stars 27 forks source link

getTile() support for 'sfc' signature #127

Closed fdetsch closed 2 years ago

fdetsch commented 2 years ago

For this code,

library(MODIS)
library(sf)

## ENVIRONMENT ====

### `MODISoptions()` ----

lap = file.path(
  tempdir()
  , "MODIS"
)

MODISoptions(
  localArcPath = lap
  , outDirPath = file.path(
    lap
    , "PROCESSED"
  )
  , quiet = FALSE
  , save = FALSE
)

### aoi ----

kibo = data.frame(
  y = -3.065053
  , x = 37.359031
) |> 
  st_as_sf(
    crs = 4326
    , coords = c("x", "y")
  )

kili = st_buffer(
  kibo
  , dist = 5e4
) |> 
  st_bbox() |> 
  st_as_sfc()

getTile(
  kili
)

an error is raised because "sfc" signatures are currently not supported in getTile():

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘getTile’ for signature ‘"sfc_POLYGON", "missing", "missing"’

fdetsch commented 2 years ago

Should be able to handle all "sfc_" signatures, not just polygon.