[R] write geotiff with projection - RGDAL package
Roger Bivand
Roger.Bivand at nhh.no
Fri Sep 7 09:29:23 CEST 2007
On Thu, 6 Sep 2007, Monica Pisica wrote:
>
> Hi,
>
> Doing more search i've discovered package RGDAL that can write a geotiff
> file with projection. I saved a geotiff file in UTM projection and if i
> read the file back in R and check the projection seems that everything
> is OK. But if i load the file in ArcGIS (ESRI product) i get the warning
> that the file is missing spatial reference so it cannot be projected,
> but it is displayed correctly. I guess somewhere i am doing a mistake
> when i define the projection in R. My code follows:
>
> data.grid <- read.csv(x, header=TRUE)
> gridded(data.grid) = ~East.m.+North.m.
> proj4string(data.grid) = CRS("+proj=tmerc +lat_0=0.00000000000 +lon_0=-81.00000000000 +k=0.99960000 +x_0=500000.000000 +y_0=0.0000000 +ellps=GRS80 +units=m")
> tr <- "e:\\JELA_veg\\test_gtiff\\test.tif"
> writeGDAL(data.grid["class.pca"], tr)
>
> mg3 <- readGDAL(tr)
> proj4string(mg3)
> [1] " +proj=utm +zone=17 +ellps=GRS80 +units=m +no_defs"
>
> I will really appreciate if anybody can point me in the right dirrection.
In my previous reply, I suggested that you visit:
http://www.gdal.org/frmt_gtiff.html
There you will find that for ESRI products, you may need to set
options="TFW=YES" at least, because ESRI products do not honour the
projection information already encoded inside the GTiff file. The
information is there, it is just that ESRI products only look for it in
places they have thought of, not in the proper places. If necessary,
showWKT() can make a *.prj file. Otherwise just override ESRI.
Roger
>
> Thanks,
>
> Monica
>
>
> _________________________________________________________________
> News, entertainment and everything you care about at Live.com. Get it now!
> http://www.live.com/getstarted.aspx
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-help
mailing list