Learn R Programming

APfun (version 0.1.6)

APpolygonize: AP Polygonize

Description

This function uses the gdal_polygonize.py GDAL utility. Its implementation was adapted from the solution developed by John Baumgartner and Francisco Rodriguez-Sanchez.

Usage

APpolygonize(
  inRaster,
  readToMemory = TRUE,
  outFile = NULL,
  OSGeoPath = "C:/OSGeo4W64",
  connectivity = 4
)

Arguments

inRaster

a RasterLayer or a path to a raster file

readToMemory

logical. Read output polygons into memory as a SpatialPolygonsDataFrame

outFile

character. Optional path for saving output as an Esri Shapefile.

OSGeoPath

character. Path to the OSGeo4W installation directory

connectivity

numeric. Can be either set to 4 (rook's case) or 8 (queen's case)

Value

SpatialPolygonsDataFrame

Details

This function needs OSGeo4W to be installed. The OSGeo4W installation path, set to 'C:/OSGeo4W64' by default, will then be used to find the gdal_polygonize.bat file.

See Also