[R-sig-Geo] Post Question
Rachel
razz2526 at yahoo.com
Sat Jun 3 15:44:23 CEST 2017
I would like to post this question:
I am trying to figure out how to reassign small polygons to its nearest neighbor in R (similar to gdal_sieve.py function).
I created a spatial polygon file from a classified gridded dataset using the grid2polygons function in R. I would now like to take that polygon file and merge any polygons containing less than 6 pixels with its nearest largest neighbor. In the image link (https://i.stack.imgur.com/6BLvP.jpg), you can see an example of small polygons circled in blue. I would like those merged with the larger surround polygon. Alternatively, if there is a way to create a minimum threshold of 6 clumped pixels prior to the conversion to polygon stage, any suggestions for that method would be great as well.
There is a function in Gdal: gdal_sieve.py that can do exactly this (http://www.gdal.org/gdal_sieve.html) if you would like to get an idea of exactly what I would like to do. Does anyone know of a way to do this in R?
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list