GeoJSON is an open standard format that is handy for representing geographic data structures in text-based JSON files. The only function (ne2geojson) in this package streamlines the process of downloading a Natural Earth shapefile (http://www.naturalearthdata.com) and converting it to GeoJSON format.
# install.packages("devtools")
devtools::install_github("kamermanpr/ne2geojson")
Create 110m scale country-level GeoJSON in current working directory:
ne2geojson(input_filename = 'ne_110m_admin_0_countries')
Create 110m scale country-level GeoJSON in new directory:
ne2geojson(input_filename = 'ne_110m_admin_0_countries',
output_dir = './country')
Create simplified 110m scale country-level GeoJSON, retaining 50% of the data:
ne2geojson(input_filename = 'ne_110m_admin_0_countries',
simplify = TRUE,
retain = 0.5)
Documentation can be found at: kamermanpr.github.io/ne2geojson/.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.