geojsonio: *I/O for GeoJSON*

geojsonioR Documentation

I/O for GeoJSON

Description

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 sf. 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() / topojson_list() - convert to GeoJSON or TopoJSON as R list format

  • geojson_json() / topojson_json() - convert to GeoJSON or TopoJSON as JSON

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

  • geojson_sf() - convert to an sf object from geojson_list or geojson_json

  • geojson_read() / topojson_read() - read a GeoJSON/TopoJSON file from file path or URL

  • geojson_write() / topojson_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

  • geo2topo() - Convert GeoJSON to TopoJSON

  • topo2geo() - Convert TopoJSON to GeoJSON

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.

Author(s)

Scott Chamberlain

Andy Teucher andy.teucher@gmail.com

Michael Mahoney mike.mahoney.218@gmail.com

See Also

Useful links:


geojsonio documentation built on Sept. 8, 2023, 5:54 p.m.