<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hey Tarek,<br>
<br>
I guess you have this issue because the g object has two bands....
(the estimated mean and variance or sd of your kriging, someone will
correct me). So your writeGDAL() should be <br>
<br>
writeGDAL(g[,,"band1"], "ordinary_kriging_1.tif",
drivername="GTiff", type="Byte")<br>
<pre wrap="">
HTH
Alex
</pre>
<br>
On 16/12/2010 16:52, Tarek Benamara wrote:
<blockquote
cite="mid:AANLkTikNseNWqG3SAKCrTXc0GS8Pn7gJeGyAxiruXfwF@mail.gmail.com"
type="cite">
<pre wrap="">Hallo,
I have used rgdal to generate a GeoTIFF for my krige Interpolation but the
output image is a 2 Band image und without RGB Color, my Question is haw to
give the RGB Color to my GeoTFF and how to increase resolution with rgdal.
And this is my R-File
## load some libraries first:
library(gstat)
library(RODBC)
library(rgdal)
library(grid)
library(intamap)
## load data
channel <- odbcConnect("postgis", "postgres", "postgres")
table = sqlQuery(channel, "SELECT max(stat.gid) as oid,max(stat.the_geom) as
the_geom,max(stat.station_latitude_d) as lat,max(stat.station_longitude_d)
as lon,max(stick.wert) as wert FROM luft_messstationen_meta as
stat,stickstoffdioxid as stick WHERE stat.gid=stick.station_id AND
date='2010-11-20' group by stat.gid order by oid;")
## gstat does not like missing data, subset original data:
e <- na.omit(table)
coordinates(e) <- ~ lon+lat
## create a grid onto which we will interpolate:
## first get the range in data
x.range <- range(e@coords[,1])
y.range <- range(e@coords[,2])
## now expand to a grid with 500 meter spacing:
grd <- expand.grid(x=seq(from=x.range[1], to=x.range[2], by=0.05),
y=seq(from=y.range[1], to=y.range[2], by=0.05) )
## convert to SpatialPixel class
coordinates(grd) <- ~ x+y
gridded(grd) <- TRUE
g <- krige(formula=wert ~1, e, grd,model=vgm(1,"Exp",300))
proj4string(g) = CRS("+init=epsg:4326")
writeGDAL(g, "ordinary_kriging_1.tif", drivername="GTiff", type="Byte")
Thanks
Tarek
</pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<address> Alexandre Villers, PhD. <br>
Postdoc researcher<br>
Spatial Ecology & Population Dynamics<br>
Section of Ecology, Department of Biology<br>
University of Turku<br>
FIN-20014 Turku<br>
Finland<br>
<br>
@mail: alexandre.villers@utu.fi<br>
phone: 00358 (0)2 333 5039<br>
<br>
Skype <a href="skype:aquila06?call"><img
src="cid:part1.07080406.04070604@gmail.com" style="border:
medium none;" alt="You can skype me (but think of using
Ekiga instead !)" height="50"></a></address>
<br>
<b>Use open source and free softwares</b><br>
<a href="http://cran.r-project.org/" title="R statistical
software"><img style="border-color: rgb(255, 255, 255);"
src="cid:part2.06050701.06090507@gmail.com" height="50"></a><spacer>
<a href="http://grass.itc.it/" title="GIS software for data
processing, easily replaces ArcMap and Mapinfo"><img
style="border-color: rgb(255, 255, 255);"
src="cid:part3.04010805.09070105@gmail.com" height="50"></a>
<a href="http://www.qgis.org/" title="GIS visualization, easily
replaces ArcMap or Mapinfo"><img style="border-color: rgb(255,
255, 255);" src="cid:part4.00080703.03040200@gmail.com"
height="50"></a> <spacer>
<a href="http://fr.openoffice.org/" title="Stop using Microsoft
Office !"><img style="border-color: rgb(255, 255, 255);"
src="cid:part5.08020607.07080701@gmail.com" height="50"></a>
<a href="http://www.mozilla-europe.org/fr/" title="Stop using
Microsoft Outlook !"><img style="border-color: rgb(255, 255,
255);" src="cid:part6.01000903.03020908@gmail.com" height="50"></a>
<a href="http://www.mozilla-europe.org/fr/" title="Stop using
Microsoft Internet Explorer !"><img style="border-color:
rgb(255, 255, 255);"
src="cid:part7.09060203.07000801@gmail.com" height="50"></a>
</div>
</body>
</html>