[R-sig-Geo] converting grid objects to spatial polygon objects and export as shapefile
mayeulk
mayeul.kauffmann at free.fr
Sat Feb 6 02:08:10 CET 2010
The following works to make a graticule for gps use. I still have some works
to add numbesr, finer grids (with crosses, etc).
Mayeul
#cellcentre.offset: centre of the box with smallest coordinates (South West
box in Italy), hence +c(500,500)
grd <- GridTopology(cellcentre.offset=c(471000,5072000)+c(500,500),
cellsize=c(1000,1000), # 1km x 1km
cells.dim=c(40,30)) #40 km West-East and 30km South-North
grd2<-SpatialGrid(grid=grd, proj4string = CRS("+init=epsg:32632 +proj=utm
+zone=32 +ellps=intl +units=m +no_defs"))
spix <- as(grd2, "SpatialPixels")
spol <- as(spix, "SpatialPolygons")
spdf <- SpatialPolygonsDataFrame(spol, data=data.frame(id=row.names(spol),
row.names=row.names(spol)))
#plot(spdf)
writeSpatialShape(x=spdf,"~/Documents/randonnee/Italie/UTM_grid_R")
#then open .shp with qgis, select the layer> properties> apply CRS
epsg:32632> OK.
#Menu preferenes>project properties>on the fly projection then choose one
pojection
--
View this message in context: http://n2.nabble.com/converting-grid-objects-to-spatial-polygon-objects-and-export-as-shapefile-tp4143331p4523475.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list