[R-sig-Geo] converting grid objects to spatial polygon objects and export as shapefile
didimayr
dieter.mayr at boku.ac.at
Mon Sep 19 12:11:50 CEST 2011
Dear all,
I am trying to do the same as above in: “converting grid objects to spatial
polygon objects and export as shapefile , Dec 10, 2009; 3:17am” with my own
data, however I do not come to any useful result. My aim is to get a
shapefile with polygons with an additional column including the overlayed
raster data. Maybe someone has an idea or some hints:
I have a shapefile converted into a SpatialPolygonsDataFrame (“R1000m”) and
a asc-rasterfile converted into a SpatialPointsDataFrame(“raster_data”)
overlay_1 <- overlay(raster_data, R1000m)
result: overlay_1 is an integer, similar to “o” in the above example, but
includes NAs, because the grid-(point) layer is greater than the Polygons.
Having a look at the SpatialPointsdataframe shows that the column with the
interesting information is called: “PNSA1145.asc”. Thus I try:
R1000m$new <- aggregate(raster_data$PNSA1145.asc, list(overlay_1), mean)$
PNSA1145.asc
This doesn’t show me any error, but nothing changed within R1000m.
possible Problems:
# rastergrid have lower resolution than Polygons -> should I use
disaggregate?
# is the overlay correct applied? Does it make sense like: overlay(R1000m,
raster_data)? Should I use "extract"?
# raster_data and R1000m do not overlay on each point: small parts of R1000m
are not overlayed.
I am extremly thankful for any ideas and information you could give me.
Kind regards
Dieter Mayr
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/converting-grid-objects-to-spatial-polygon-objects-and-export-as-shapefile-tp4143331p6807877.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list