# The spatial objects can be retrieved with: The partitions1 and partitions2 objects are of the RasterLayer class from raster, so the vmeasure_calc() function works correctly. Secondly, other packages with methods we want to use, could only accept one specific spatial class, but not the other.įor example, the current version of the sabre package (Nowosad and Stepinski 2019) (0.3.2) accepts objects from the raster package, but not ones from terra or stars 2. # from to offset delta refsys point values x/y # stars object with 2 dimensions and 1 attribute Srtm_stars = read_stars(raster_file_path) # crs : +proj=longlat +datum=WGS84 +no_defs The raster object: raster_file_path = system.file("raster/srtm.tif", package = "spDataLarge") To illustrate this, let’s read the same spatial data, srtm.tif from the spDataLarge package (Nowosad and Lovelace 2021), using raster and stars. Of course, having more than one package (with its own spatial class/es) for a vector or raster data model could be problematic, especially for new or inexperienced users.įirst, it takes time to understand how different spatial classes are organized. In this process, new methods are created, higher performance code is added, and possible workflows are expanded.Īlternative approaches allow for a (hopefully) healthy competition, resulting in better packages. New packages are being developed, while old ones are modified or superseded. Spatial raster data can be stored as objects from terra (Hijmans 2021 b) and its predecessor raster (Hijmans 2021 a), or alternatively the stars package (Pebesma 2021 b).Īs you could see in our Why R? webinar talk, the spatial capabilities of R constantly expand, but also evolve. Nowadays, the most prominent packages to represent spatial vector data are sf (Pebesma 2021 a) and its predecessor sp (Pebesma and Bivand 2021), however, the terra (Hijmans 2021 b) package also has its own spatial class for vector data. Spatial classes are slightly different from regular R objects, such as data frames or matrices, as they need to not only store values, but also information about spatial locations and their coordinate reference systems. Therefore, there had been a need to create R tools able to represent spatial vector and raster data. Natively R does not support spatial data and does not have a definition of spatial classes. There are two main 1 spatial data models – spatial vector data and spatial raster data. The R programming language has, over the past two decades, evolved substantial spatial data analysis capabilities, and is now one of the most powerful environments for undertaking geographic research using a reproducible command line interface.Ĭurrently, dedicated R packages allow to read spatial data and apply a plethora of different kinds of spatial methods in a reproducible fashion.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |