View source: R/write_geojson.R
write_geojson | R Documentation |
write.table
.write_geojson_js
is a simple extension which adds a var
to the
GeoJSON string so leaflet and other JavaScript libraries can assign the
objects easily.
write_geojson(sp, file, pretty = TRUE, round = NA)
write_geojson_js(sp, file, name = NA, pretty = TRUE, round = NA)
sp |
Spatial object to be written as GeoJSON file. |
file |
File name of GeoJSON file. |
pretty |
Format the JSON for readability. |
round |
How many decimal points should the coordinate pairs be exported
with? Default is maximum but |
name |
Name of JavaScript object (only used in |
Stuart K. Grange
## Not run:
# Export spatial object as GeoJSON file
write_geojson(sp_thames_locks, "thames_locks.json", pretty = TRUE)
# Export spatial object as GeoJSON file ready for leaflet
write_geojson(sp_thames_locks, "thames_locks.js", name = "data_locks")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.