Geographic Information Systems Asked by Arthur_Morgan on January 16, 2021
I have a raster with 500 meter resolution that was in sinusoidal
projection, so I first converted it to WGS84
using the raster
package in R using the following code:
library (raster)
library(maptools)
#Load the tif file
tif <- raster("~/Sinu.tif")
# Extract the SRS of the original tif
CRS <- "+proj=sinu +lan_0=0 +x_0=0 +y_0=0 +R=631007.181 +units=m +no_defs"
#Transform the projection to WGS84
llcrs <- "+proj=longlat +ellps=WGS84 +datum=WGS84"
#Create a data frame of the original sinusoidal tif
DF <- as.data.frame(Sinu, xy=TRUE)
data(DF)
#Create the Transform
rll <- projectRaster(Sinu,crs = llcrs)
#ras_sinu <- raster(nrow=391, ncol=695, ext=extent(-9031818, 4773511, -870816, 4954666), crs=incrs)
#rs <- rasterImage(w, ras_sinu)
plot(rll)
Sin2WGS84 <- writeRaster(rll,filename = "~/Sinu2WGS84.tif")
The conversion was done to align the pixels of this finer resolution raster with another raster which is in WGS84
and has a spatial resolution of 1/16 (approximate to 6 kilometers). The coarser resolution raster has a representative gridded polygon file. I then imported the transformed tif file to ArcGIS and converted it to a Polygon in ArcGIS. This was done to see whether 12×12 (12 rows by 12 columns of pixels) 500M meter pixels fall in a coarser pixel. But as you can see in the following image I am getting either 10×10 or 11×11 pixels. What can I do in R or ArcGIS to solve this alignment problem? If anyone wants to access the data, please click here.
"another raster which is in WGS84 and has a spatial resolution of 6 kilometers"
These two things can't both be true. A raster in WGS84 coordinates is defined by a regular grid in lat-long, and you can't have a regular grid in lat-long that is also an exact number of kilometers everywhere because the size of a degree of longitude changes according to the latitude.
Data in lat-long that claims to have a resolution in kilometres is usually referring to an approximate size, or possibly a size at the equator where latitude and longitude have the same size on the ground.
Correct answer by Spacedman on January 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP