1

Hi i been trying to reproject a raster image from Equirectangular to EPSG:4326 (Latlon), the issue is that every time i run my code on R, i get the wrong coordinates on the new image; i don´t know where is the error in the code, also i do the same process with Qgis, and i got the same result, it´s strange, i got the opportunity to do the same reprojection process in ENVI, and the result was succesful, help please!!!

a <- raster("C:/Users/<username>/Documents/imageexample.tif")
> a
class       : RasterLayer 
dimensions  : 1800, 1800, 3240000  (nrow, ncol, ncell)
resolution  : 1100, 1100  (x, y)
extent      : -988900, 991100, 1677577, 3657577  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=eqc +lat_ts=0 +lat_0=24 +lon_0=-112 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
data source : C:/Users/<username>/Documents/imageexample.tif
names       : imageexample

g1 <- projectRaster(a, crs="+init=epsg:4326")
> g1
class       : RasterLayer 
dimensions  : 1810, 1810, 3276100  (nrow, ncol, ncell)
resolution  : 0.00988, 0.00988  (x, y)
extent      : -120.9328, -103.05, 39.02317, 56.90597  (xmin, xmax, ymin, ymax)
coord. ref. : +init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0 
data source : in memory
names       : imageexample.tif 
values      : -5.000117, 39.87529  (min, max)

The correct coordinates should be like this:

    class       : RasterLayer 
dimensions  : 1793, 1803, 3232779  (nrow, ncol, ncell)
resolution  : 0.0108098, 0.009931556  (x, y)
extent      : -121.735, -102.245, 15.08612, 32.8934  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
data source : C:/Users/<username>/Documents/CORRECTimageexample.tif 
names       : CORRECTimageexample

Thanks!!!

4

1 に答える 1

1

これは少し特殊なケースですが、通常、ラスター再投影の範囲と解像度は (データによって) 定義されていません。これらを指定する必要があります。たとえば、次のことができます。

library(raster)
r <- raster(xmn=-121.735, xmx=-102.245, ymn=15.08612, ymx=32.8934, nrow=1793, ncol=1803, crs='+proj=longlat +ellps=WGS84')
g2 <- projectRaster(a, r)
于 2013-09-28T04:28:02.743 に答える