Re: [R] write geotiff with projection - RGDAL package

2007-09-07 Thread Roger Bivand
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.000 
 +lon_0=-81.000 +k=0.9996 +x_0=50.00 +y_0=0.000 
 +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: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] write geotiff with projection - RGDAL package

2007-09-06 Thread Monica Pisica

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.000 
+lon_0=-81.000 +k=0.9996 +x_0=50.00 +y_0=0.000 
+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.
 
Thanks,
 
Monica

 
_


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.