[R-sig-Geo] gdal_translate and gdalwarp question

Roger Bivand Roger.Bivand at nhh.no
Tue Sep 22 15:51:23 CEST 2015


You posted the same message to R-help at Sun Sep 20 16:52:07 CEST 2015, so 
less than two hours after this post, cross-posting is bad anyway, and for 
such a specialised question, you should never expect immediate response. 
You do not state that this concerns the gdalUtils package, nor what 
version you are using on what platform. Can you simply use the GDAl 
command line utility until you figure out what you are doing wrong?

Roger

On Sun, 20 Sep 2015, Antonio Silva wrote:

> Hello,
>
> I have some doubts on the usage of some gdal tools.
>
> After converting a hdf file to tif I want to reproject to SIRGAS2000 and
> clip between lats of 22 to 29 S and lats of 40 to 50 W.
>
> HDF file can be downloaded at
> https://app.box.com/s/16cf7qv6af6gsz1v66staori2mtneu0r
>
> Basically I'm following
> https://scottishsnow.wordpress.com/2014/08/24/many-rastered-beast/
>
> Well to convert HDF file I'm using:
>
> gdal_translate("A20080012008031.L3m_MO_SST_4","georef.tif",sd_index=1,a_ullr=c(0,4320,8640,0),
> a_srs="+proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371007
> +b=6371007 +units=m +no_defs")
>
> Without a_ullr and a_srs options I was getting an error message when using
> gdalwarp: "ERROR 1: Unable to compute a transformation between pixel/line
> and georeferenced coordinates"
>
> a_ullr and a_srs values I got with GDALinfo("georef.tif")
>
> map <- raster("georef.tif")
> plot(map)
>
> My problem now is reproject to SIRGAS2000 and clip the image georef.tif:
>
> gdalwarp("georef.tif", "georef2.tif",
> s_srs="+proj=eqc +lat_ts=0 +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371007
> +b=6371007 +units=m +no_defs",
> t_srs="+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs")
>
> map2 <- raster("georef2.tif")
> plot(map2)
>
> Map2 is not in SIRGAS2000 projection and clipping option
> te=c(-50,-29,-40,-22) does not work.
>
> Where is my mistake? I hope someone can tell me.
>
> Thanks for any help.
>
> Antonio Olinto
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> -- 
> Antônio Olinto Ávila da Silva
> Biólogo / Oceanógrafo
> Instituto de Pesca (Fisheries Institute)
> São Paulo, Brasil
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list