[R-sig-Geo] interp.old and write.ascii.grid
Tomislav Hengl
T.Hengl at uva.nl
Fri Oct 10 11:26:50 CEST 2008
try this:
***********************
library(akima)
library(spatstat)
library(maptools)
ew <- as.vector(c(1394180, 1398190, 1399690, 1395780, 1397820, 1395290, 1394995, 1399475, 1410825))
ns <- as.vector(c(6200295, 6201020, 6200420, 6205105, 6206590, 6208305, 6210370, 6213715, 6214870))
cures <- as.vector(c(48, 52, 59, 84, 50, 46, 114, 92, 48))
sn8 <- data.frame(ew, ns, cures)
coordinates(sn8) <- ~ew+ns
sn8.interpold <- interp(ew, ns, cures, xo= seq(min(ew), max(ew), length = 400), yo=seq(min(ns),
max(ns), length = 300), linear=T)
sn8.interpold.grid <- as.SpatialGridDataFrame.im(as.im(sn8.interpold))
spplot(sn8.interpold.grid, col.regions=bpy.colors(), sp.layout=list("sp.points", pch="+", sn8))
slot(slot(sn8.interpold.grid, "grid"), "cellsize") <- rep(mean(slot(slot(sn8.interpold.grid,
"grid"), "cellsize")), 2)
write.asciigrid(sn8.interpold.grid[1], "asciisn8", na.value = -9999)
***********************
cheers,
Tom Hengl
http://spatial-analyst.net
-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
Mikael Carlsson
Sent: vrijdag 10 oktober 2008 9:15
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] interp.old and write.ascii.grid
Hello!
I have a text file that looks like
ew;ns;cures
1394180;6200295;48
1398190;6201020;52
1399690;6200420;59
1395780;6205105;84
1397820;6206590;50
1395290;6208305;46
1394995;6210370;114
1399475;6213715;92
1410825;6214870;48
and so on
I manage to interpolate with
sn8.interpold <- interp.old(ew, ns, cures,
xo= seq(min(ew), max(ew), length = 400),
yo=seq(min(ns), max(ns), length = 300),
ncp = 4, extrap=FALSE, duplicate = "error", dupfun = NULL)
then I want to crate a asciigrid...
write.asciigrid(sn8.interpold,"asciisn8", na.value = -9999)
and here I got problems...
Any tips?
Thanks Mikael
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list