[R-sig-Geo] rasterTopolygons: singleparts often needed

John Baumgartner johnbaums at gmail.com
Sun Feb 26 13:14:45 CET 2017


Not at my computer, but does sp::disaggregate(v) return your singlepart
polygons?

On Sun, 26 Feb 2017 at 22:40, Agustin Lobo <alobolistas at gmail.com> wrote:

> Could raster::rasterTopolygons() be modified in future versions
>
> to optionally output singlepart polygons? e.g, in the following
>
> r <-raster(nrow=16, ncol=16)
>
> d <- rep(rep(1:4,rep(4,4)),8)
>
> r[] <- c(d,rev(d))
>
> plot(r)
>
> v <- rasterToPolygons(r,dissolve=TRUE)
>
> plot(v[1,])
>
> dim(v at data)
>
>
>
> the new option
>
> v <- rasterToPolygons(r,dissolve=TRUE,single=TRUE)
>
> would result on
>
> plot(v[1,])
>
> displaying one single square and
>
> dim(v at data)
>
> would be 8 rows and 1 column
>
>
>
> (equivalent to gdal_polygonize)
>
>
>
> Agus
>
>
>
> _______________________________________________
>
> R-sig-Geo mailing list
>
> R-sig-Geo at r-project.org
>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list