[R-sig-Geo] Plotting satellite image in R via sp package -> grid
Jan.Verbesselt at csiro.au
Jan.Verbesselt at csiro.au
Wed May 30 08:57:37 CEST 2007
Dear,
I would like to plot an grid (subset of a satellite image in Sinusoidal
projection) as an spatialobject in R via the sp package (R version 2.5,
winXP).
The following works fine:
sinusgrid <- read.table( see for data sample below , header=TRUE,
sep=",", na.strings="NA", dec=".", strip.white=TRUE)
sinusgrid <- as.data.frame(sinusgrid)
coordinates(sinusgrid)=~x+y
proj4string(sinusgrid) = CRS("+proj=sinu +lon_0=0 +x_0=0 +y_0=0
+a=6371000 +b=6371000 +units=m") # Sinusoidal projection
l2 = list("SpatialPolygonsRescale", layout.north.arrow(), offset =
c(13416000,-3939000), scale = 500)
l3 = list("SpatialPolygonsRescale", layout.scale.bar(), offset =
c(13416000,-3940000), scale = 1000, fill=c("transparent","black"))
spplot(sinusgrid, "ndvi", do.log = TRUE,
key.space=list(x=0.2,y=0.8,corner=c(0,1)), scales=list(draw=T), cuts =
4,
sp.layout=list(l2,l3) )
But when I try ;
gridded(sinusgrid) <- TRUE
I obtain the following error message:
suggested tolerance minimum: 4.31585196603024e-06Error in
points2grid(points, tolerance) : dimension 1 : coordinate intervals are
not constant
before I can use image(sinusgrid) in order to create a spatial map to
which I could overlay vectorlayers and points.
The data is extracted from a satellite image which was projected in
sinusoidal projection (ProjParams =
(6371007.181000,0,0,0,0,0,0,0,21600,0,1,0,0).
How could this satellite data be projected in R such that other shape
files and points can be overlaid on the map?
Regards and thx,
Jan
### Data set: pixels of an satellite image.
x,y,index
13415234.67,-3935966.551,0.83
13415234.67,-3936198.255,0.83
13415234.67,-3936429.96,0.82
13415234.67,-3936661.665,0.87
13415234.67,-3936893.369,0.87
13415234.67,-3937125.074,0.87
13415234.67,-3937356.779,0.88
13415234.67,-3937588.483,0.86
13415234.67,-3937820.188,0.88
13415234.67,-3938051.893,0.77
13415234.67,-3938283.597,0.77
13415234.67,-3938515.302,0.92
13415234.67,-3938747.006,0.89
13415234.67,-3938978.711,0.89
13415234.67,-3939210.416,0.81
13415234.67,-3939442.12,0.76
13415234.67,-3939673.825,0.76
13415234.67,-3939905.53,0.85
13415234.67,-3940137.234,0.85
13415466.38,-3935966.551,0.83
13415466.38,-3936198.255,0.82
13415466.38,-3936429.96,0.83
13415466.38,-3936661.665,0.83
13415466.38,-3936893.369,0.87
13415466.38,-3937125.074,0.89
13415466.38,-3937356.779,0.80
13415466.38,-3937588.483,0.86
13415466.38,-3937820.188,0.88
13415466.38,-3938051.893,0.87
______________________________________________
Jan Verbesselt, Phd
Post-Doctoral Research Fellow - Remote sensing
Ensis - the joint forces of CSIRO and Scion
Private Bag 10
Clayton South, VIC 3169, Australia
Tel: + 61 3 9545 2265
Fax: + 61 3 9545 2448
More information about the R-sig-Geo
mailing list