Skip to contents

CRTwrite exports a simple features object in a GIS format

Usage

CRTwrite(
  object,
  dsn,
  feature = "clusters",
  buffer_width,
  maskbuffer = 0.2,
  ...
)

Arguments

object

object of class 'CRTsp'

dsn

dataset name (relative path) for output objects

feature

feature to be exported, options are:

'cluster'cluster assignments
'arms'arm assignments
'buffer'buffer zone or spillover zone
'mask'mask for areas that are distant from habitations
buffer_width

width of buffer between discordant locations (km)

maskbuffer

radius of buffer drawn around inhabited areas (km)

...

other arguments passed to 'sf::write_sf'

Value

obj, invisibly

Details

'sf::write_sf' is used to format the output. The function returns TRUE on success, FALSE on failure, invisibly.

If the input object contains a 'centroid' then this is used to compute lat long coordinates, which are assigned the "WGS84" coordinate reference system. Otherwise the objects have equirectangular co-ordinates with centroid (0,0).

If feature = 'buffer' then buffer width determination is as described under plotCRT().

The output vector objects are constructed by forming a Voronoi tessellation of polygons around each of the locations and combining these polygons. The polygons on the outside of the study area extend outwards to an external rectangle. The 'mask' is used to mask out the areas of these polygons that are at a distance > maskbuffer from the nearest location.

Examples

# \donttest{
        tmpdir = tempdir()
        dsn <- paste0(tmpdir,'/arms')
        CRTwrite(readdata('exampleCRT.txt'), dsn = dsn, feature = 'arms',
        driver = 'ESRI Shapefile', maskbuffer = 0.2)
#> Writing layer `arms' to data source 
#>   `C:\Users\smith\AppData\Local\Temp\RtmpMFpVzL/arms' using driver `ESRI Shapefile'
#> Writing 2 features with 1 fields and geometry type Multi Polygon.
    # }