[R-sig-Geo] Dissolve polygon

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Jul 21 09:31:30 CEST 2012


On Fri, Jul 20, 2012 at 8:40 PM, Céline Bellard
<bellard.celine at gmail.com> wrote:
> Hi,
>
> I am working with  a SpatialPolygonsDataFrame of many islands. There are a
> lot of polygons (islands) composing my SpatialPolygonsDataFrame.
> I want to extract the elevation of each island.
> I need to separate the different polygons (like dissolve function in
> arcgis), to have the elevation of each island.
>
> Do you have an idea how can I do that ?
>
> dim(hot)
> [1] 10945     5
>
> class(hot)
> [1] "SpatialLinesDataFrame"
> attr(,"package")
> [1] "sp"

 Looks like you have 10945 features in your shapefile...

 The extract function in the raster package will process pixels under
polygons. In this example, I sum a pollution raster over each lake
("Lake Exposure", about half-way down)

http://www.maths.lancs.ac.uk/~rowlings/Teaching/UseR2012/plume.html

 You probably want something like the mean or the max of the pixels
over each island. In your case, you should end up with 10945 values.

Barry



More information about the R-sig-Geo mailing list