Geographic Information Systems Asked on July 6, 2021
An extension to this question, so when I export the raster as a .tif file, the resultant GeoTIFF file is not similar to the plot in R below. Am I missing a step in the following code? See the images below for comparison. The respective files can be downloaded from here.
d <- read.csv("sample_data.csv")
coordinates(d) <- ~X+Y
data<-data.frame(d$X,d$Y,d$VIC_SC_04)
spdf <- SpatialPixelsDataFrame(d, tolerance = 0.016129, d@data)
# Create the raster
r <- raster(spdf, layer=3)
# Set the projection to WGS-84
crs(r) = "+proj=longlat +datum=WGS84"
# Export the raster
rstr_WGS84 <- writeRaster(rstr,filename = "~/Sample_raster.tif", overwrite=TRUE)
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP