I/O for GeoJSON


Convert various data formats to/from GeoJSON or TopoJSON. This package focuses mostly on converting lists, data.frame's, numeric, SpatialPolygons, SpatialPolygonsDataFrame, and more to GeoJSON with the help of rgdal and friends. You can currently read TopoJSON - writing TopoJSON will come in a future version of this package.

Package organization

The core functions in this package are organized first around what you're working with or want to get, geojson or topojson, then convert to or read from various formats:

  • geojson_list - convert to geojson as R list format

  • geojson_json - convert to geojson as json

  • geojson_sp - convert to a spatial object from geojson_list or geojson_json

  • geojson_read / topojson_read - read a geojson/topojson file from file path or URL

  • geojson_write - write a geojson file locally (topojson coming later)

Other interesting functions:

  • map_gist - Create a GitHub gist (renders as an interactive map)

  • map_leaf - Create a local interactive map using the leaflet package

  • lint - Checks validity of geojson using the Javascript library geojsonhint. See also geojsonio-deprecated

  • validate - Checks validity of geojson using the web service at http://geojsonlint.com/. See also geojsonio-deprecated

All of the above functions have methods for various classes, including numeric vectors, data.frame, list, SpatialPolygons, SpatialLines, SpatialPoints, and many more - which will try to do the right thing based on the data you give as input.


Scott Chamberlain myrmecocystus@gmail.com

Andy Teucher andy.teucher@gmail.com

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus