geojson_convert: Convert shapefiles to GeoJSON.

Description Usage Arguments

View source: R/geojson_convert.R

Description

A convenience wrapper building on functions readOGR, spTransform, gSimplify, geojson_json, geojson_write, and geojson_lint to convert shapefiles to geojson files.

Usage

1
2
3
4
geojson_convert(dir.path, input.file, output.file = NULL,
  crs = "+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0",
  box.long = c(-180, 180), box.lat = c(-90, 90), simplify = FALSE,
  tolerance = 0, topology = TRUE, validate = FALSE)

Arguments

dir.path

Path (no trailing '/') to the 'shapefile' folder. This folder must contain, at a bare minimum, files with the extensions .shp, .shx, and .dbf).

input.file

A single character string specifying the filename shared by the files in the shapefile folder.

output.file

A single character string specifying the filename of the output file (no extension, such as '.geojson' is required). The default value is emphNULL, and the file will be given the name of the input file name.

crs

A single character string specifying the Coordinate Reference System to use. The default value is '+init=epsg:4326 +proj=longlat +ellp =WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0'.

box.long

Set the longitudinal scope of the bounding box (default range is -180 to 180 degrees).

box.lat

Set the latitudinal scope of the bounding box (default range is -90 to 90 degrees).

simplify

Logical (default value is FALSE) specifying whether to simplify the given geometry using the Douglas-Peuker algorithm.

tolerance

Numerical tolerance value to be used by the Douglas-Peuker algorithm. Greater values produce greater simplification (default value is 0).

topology

Logical specifying whether the Douglas-Peuker algorithm should attempt to preserve the topology of the original geometry (default value is TRUE).

validate

Logical specifying whether to validate the output GeoJSON using the geojsonlint.com web service (default value is FALSE).


kamermanpr/geojsonBASIC documentation built on May 18, 2017, 9:33 p.m.