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.
converting grid objects to spatial polygon objects and export as shapefile
2 messages · didimayr, Tom Gottfried
Hi, use over(R1000m, raster_data) wich should give you the desired result. overlay() is deprecated. Regards, Tom Am 19.09.2011 12:11, schrieb didimayr:
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.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Technische Universit?t M?nchen Department f?r Pflanzenwissenschaften Lehrstuhl f?r Gr?nlandlehre Alte Akademie 12 85350 Freising / Germany Phone: ++49 (0)8161 715324 Fax: ++49 (0)8161 713243 email: tom.gottfried at wzw.tum.de http://www.wzw.tum.de/gruenland