Geographic Information Systems Asked by user111024 on August 15, 2021
I’m trying to learn my way around stars
. Given the meuse.grid
data, how can I make a stars
object that has the same dimensions, extent, etc. as I can get from going from SpatialPointsDataFrame
to SpatialPixelsDataFrame
to raster
? In the example below, how can I make mg1
and mg2
equivalent?
library(tidyverse)
library(sf)
library(stars)
library(sp)
library(raster)
data(meuse.grid)
mg1 <- meuse.grid
coordinates(mg1) = ~x+y
proj4string(mg1) <- CRS("+init=epsg:28992")
gridded(mg1) = TRUE
mg1 <- raster(mg1)
mg2 <- meuse.grid
mg2 <- mg2 %>% st_as_sf(coords = c("x", "y")) %>%
st_set_crs(value = 28992) %>%
st_rasterize(dx=40,dy=40)
mg1
mg2
dim(mg2)
dim(mg1)
bbox(mg1)
st_bbox(mg2)
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP