Hello!
I have already searched the Forum?s archives and sp documentation, but the
answer is still unclear to this basic question : how can you clip a
SpatialGridDataFrame with a SpatialPolygons and return a new clipped
SpatialGridDataFrame (not a vector !).
Here is my data as an example :
summary(D.tls.SPGDF)
Object of class SpatialGridDataFrame
Coordinates:
min max
[1,] 828049.000 828191.000
[2,] 101770.000 101915.000
[3,] 321.632 480.632
Is projected: TRUE
proj4string :
[+init=epsg:27561 +proj=lcc +lat_1=49.50000000000001
+lat_0=49.50000000000001 +lon_0=0
+k_0=0.999877341 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515
+towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs]
Grid attributes:
cellcentre.offset cellsize cells.dim
1 828049.500 1 142
2 101770.500 1 145
3 322.132 1 159
Data attributes:
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0.000 0.000 0.000 0.000 0.000 0.969 6895.000
summary(g)
Object of class SpatialPolygons
Coordinates:
min max
x 828103.9 828133.9
y 101839.3 101869.3
Is projected: TRUE
proj4string :
[+init=epsg:27561 +proj=lcc +lat_1=49.50000000000001
+lat_0=49.50000000000001 +lon_0=0
+k_0=0.999877341 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515
+towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs]
If I do :
o <- overlay(D.tls.SPGDF, g)
R returns a vector
Which is the function that returns the initial object i.e.
SpatialGridDataFrame ?
Nathalie
Nathalie MORIN
Doctorante en t?l?d?tection foresti?re (Ph.D student in remote sensing
applied to forestry)
Centre d?application et de recherches en t?l?d?tection (CARTEL)
D?partement de G?omatique Appliqu?e
Sherbrooke (QC) CANADA J1K 2R1
T?l. : + 1 (819) 821-8000 #62962
e-mail : <mailto:Nathalie.M.Morin at Usherbrooke.ca>
Nathalie.M.Morin at Usherbrooke.ca
<http://www.usherbrooke.ca/> Universit? de Sherbrooke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20121218/6df98714/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1245 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20121218/6df98714/attachment.gif>