[R-sig-Geo] grid and spatial selection
Laetitia Blanc
blanc.laetitia.esr34 at gmail.com
Fri Jul 23 12:28:10 CEST 2010
Hi,
I have imported 2 Shapefiles : the first one is a map (france) and the
second one is a grid (cross-ruling) (maillesfrance) with cells' size =3x3km.
Then i've imported points with specific coordinates (csv) that i transformed
(spcsv2) into the same coordinate system as the map and the grid.
Code:
#import the map :
france <- readShapePoly("E:/docs stage/GIS/Fonds de
carte/test/FranceDpt.shp", proj4string=CRS("+init=epsg:27572"))
#import the grid
maillesfrance <- readShapePoly ( "E:/docs stage/R/mailles3x3_Intersect.shp",
proj4string=CRS ("+init=epsg:27572") )
#points :
csv <- read.csv ("indicesdommages2009.csv", header=TRUE, sep=";")
csv2 <- data.frame (csv)
spcsv2 <- csv2
#transform into SpatialPointDataFrame
coordinates ( spcsv2 ) <- ~ X500 + Y500
proj4string ( spcsv2 ) <- CRS("+init=epsg:27572")
#plot
plot(france)
plot(maillesfrance,col="green",add=TRUE)
plot(spcsv2,col="red",pch=16,add=TRUE)
I would like to realise a spatial selection of the cells of 3x3km that
contain one (or more) points from the object spcsv2 and then to highlight
those cells. I have done it with ArcGIS but is it possible with R ? If it's
not possible from a shapefile, how can i use the function grid() specifying
the cellsize to create a new grid ?
Any help would be great...
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/grid-and-spatial-selection-tp5329029p5329029.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list