View source: R/geojson_convert.R
A convenience wrapper building on functions readOGR, spTransform, gSimplify, geojson_json, geojson_write, and geojson_lint to convert shapefiles to geojson files.
1 2 3 4 |
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). |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.