Package: geojsonio 0.11.3.9000

Michael Mahoney

geojsonio: Convert Data from and to 'GeoJSON' or 'TopoJSON'

Convert data to 'GeoJSON' or 'TopoJSON' from various R classes, including vectors, lists, data frames, shape files, and spatial classes. 'geojsonio' does not aim to replace packages like 'sp', 'rgdal', 'rgeos', but rather aims to be a high level client to simplify conversions of data from and to 'GeoJSON' and 'TopoJSON'.

Authors:Scott Chamberlain [aut], Andy Teucher [aut], Michael Mahoney [aut, cre]

geojsonio_0.11.3.9000.tar.gz
geojsonio_0.11.3.9000.zip(r-4.5)geojsonio_0.11.3.9000.zip(r-4.4)geojsonio_0.11.3.9000.zip(r-4.3)
geojsonio_0.11.3.9000.tgz(r-4.5-any)geojsonio_0.11.3.9000.tgz(r-4.4-any)geojsonio_0.11.3.9000.tgz(r-4.3-any)
geojsonio_0.11.3.9000.tar.gz(r-4.5-noble)geojsonio_0.11.3.9000.tar.gz(r-4.4-noble)
geojsonio_0.11.3.9000.tgz(r-4.4-emscripten)geojsonio_0.11.3.9000.tgz(r-4.3-emscripten)
geojsonio.pdf |geojsonio.html
geojsonio/json (API)
NEWS

# Install 'geojsonio' in R:
install.packages('geojsonio', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/ropensci/geojsonio/issues9 issues

Pkgdown site:https://docs.ropensci.org

Datasets:
  • canada_cities - This is the same data set from the maps library, named differently
  • states - This is the same data set from the ggplot2 library
  • us_cities - This is the same data set from the maps library, named differently

On CRAN:geojsonio-0.11.3(2023-09-06)

Conda:r-geojsonio-0.11.3(2025-03-25)

geojsontopojsongeospatialconversiondatainput-outputio

10.80 score 151 stars 13 packages 2.9k scripts 5.0k downloads 24 exports 56 dependencies

Last updated 1 years agofrom:7e4cc683ed (on main). Checks:8 OK. Indexed: yes.

TargetResultLatest binary
Doc / VignettesOKFeb 25 2025
R-4.5-winOKFeb 25 2025
R-4.5-macOKFeb 25 2025
R-4.5-linuxOKFeb 25 2025
R-4.4-winOKFeb 25 2025
R-4.4-macOKFeb 25 2025
R-4.3-winOKFeb 25 2025
R-4.3-macOKFeb 25 2025

Exports:%>%as.jsonas.locationboundscentroidfile_to_geojsongeo2topogeojson_atomizegeojson_jsongeojson_listgeojson_readgeojson_sfgeojson_spgeojson_stylegeojson_writemap_gistmap_leafprettyprojectionstopo2geotopojson_jsontopojson_listtopojson_readtopojson_write

Dependencies:bitbit64classclassIntclicliprcpp11crayoncrulcurlDBIe1071fansigeojsongeojsonsfgeometriesgluehmshttpcodejqrjsonifyjsonliteKernSmoothlatticelazyevallifecyclemagrittrMASSmimepillarpkgconfigprettyunitsprogressprotoliteproxyR6rapidjsonrRcppreadrrlangs2sfsfheaderssptibbletidyselecttriebeardtzdbunitsurltoolsutf8V8vctrsvroomwithrwk

Citation

To cite package ‘geojsonio’ in publications use:

Chamberlain S, Teucher A, Mahoney M (2025). geojsonio: Convert Data from and to 'GeoJSON' or 'TopoJSON'. R package version 0.11.3.9000, , https://github.com/ropensci/geojsonio.

Corresponding BibTeX entry:

  @Manual{,
    title = {geojsonio: Convert Data from and to 'GeoJSON' or
      'TopoJSON'},
    author = {Scott Chamberlain and Andy Teucher and Michael Mahoney},
    year = {2025},
    note = {R package version 0.11.3.9000, },
    url = {https://github.com/ropensci/geojsonio},
  }

Readme and manuals

geojsonio

Convert various data formats to GeoJSON or TopoJSON

This package is a utility to convert geographic data to GeoJSON and TopoJSON formats. Nothing else. We hope to do this one job very well, and handle all reasonable use cases.

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/TopoJSON as R list format
  • geojson_json()/topojson_json() - convert to GeoJSON/TopoJSON as JSON
  • geojson_sp() - convert output of geojson_list() or geojson_json() to sp spatial objects
  • geojson_sf() - convert output of geojson_list() or geojson_json() to sf objects
  • geojson_read()/topojson_read() - read a GeoJSON/TopoJSON file from file path or URL
  • geojson_write()/topojson_write() - write a GeoJSON/TopoJSON file locally

Each of the above functions have methods for various objects/classes, including numeric, data.frame, list, SpatialPolygons, SpatialLines, SpatialPoints, etc.

Additional functions:

  • map_gist() - push up a GeoJSON or topojson file as a GitHub gist (renders as an interactive map)
  • map_leaf() - create a local interactive map using the leaflet package

*json Info

Install

Mac

Install GDAL on the command line first, e.g., using homebrew

brew install gdal

Linux

Get deps first

remotes::system_requirements("ubuntu", "20.04", package = "geojsonio")
#>  [1] "apt-get install -y make"                
#>  [2] "apt-get install -y libssl-dev"          
#>  [3] "apt-get install -y libgdal-dev"         
#>  [4] "apt-get install -y gdal-bin"            
#>  [5] "apt-get install -y libgeos-dev"         
#>  [6] "apt-get install -y libproj-dev"         
#>  [7] "apt-get install -y libsqlite3-dev"      
#>  [8] "apt-get install -y libudunits2-dev"     
#>  [9] "apt-get install -y libprotobuf-dev"     
#> [10] "apt-get install -y protobuf-compiler"   
#> [11] "apt-get install -y libcurl4-openssl-dev"
#> [12] "apt-get install -y libnode-dev"         
#> [13] "apt-get install -y libjq-dev"

Install geojsonio

Stable version from CRAN

install.packages("geojsonio")

Or development version from GitHub

install.packages("remotes")
# remotes::install_github("ropensci/geojsonio")
install.packages("geojsonio", repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))
library("geojsonio")

What’s the future of geojsonio?

geojsonio is stable and we expect it to stay on CRAN. The package is a dependency for a number of other packages and is downloaded tens of thousands of times per month; moving forward the priority with this package is to make sure that those packages and users are able to keep using the package.

That said, we do not anticipate much further development; there will not likely be many major new features added or new interfaces developed. We’ll avoid making breaking changes as much as possible.

If you find bugs in geojsonio or want to contribute new features: please feel free to submit PRs! So long as the existing interface stays intact, we’d be more than happy to make the package more useful for you. That said, we don’t anticipate being particularly responsive to feature requests (without a matching PR) moving forward.

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for geojsonio in R doing citation(package = 'geojsonio')
  • Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Help Manual

Help pageTopics
Convert inputs to JSONas.json
Convert a path or URL to a location object.as.location
Get bounds for a list or geo_listbounds
This is the same data set from the maps library, named differentlycanada_cities
Get centroid for a geo_listcentroid
Convert spatial data files to GeoJSON from various formats.file_to_geojson
GeoJSON to TopoJSON and backgeo2topo topo2geo
Atomizegeojson_atomize
Convert many input types with spatial data to geojson specified as a json stringgeojson_json
Convert many input types with spatial data to geojson specified as a listgeojson_list
Read geojson or other formats from a local file or a URLgeojson_read
Convert objects to an sf classgeojson_sf
Convert objects to spatial classesgeojson_sp
Style a data.frame or list prior to converting to geojsongeojson_style
Convert many input types with spatial data to a geojson filegeojson_write
Add together geo_list or json objects+.geo_list +.json geojson-add
*I/O for GeoJSON*geojsonio-package geojsonio
Publish an interactive map as a GitHub gistmap_gist
Make an interactive map locallymap_leaf
PostGIS setuppostgis
Convert json input to pretty printed outputpretty
topojson projections and extensionsprojections
This is the same data set from the ggplot2 librarystates
Convert many input types with spatial data to TopoJSON as a JSON stringtopojson_json
Convert many input types with spatial data to TopoJSON as a listtopojson_list
Read topojson from a local file or a URLtopojson_read
Write TopoJSON from various inputstopojson_write
This is the same data set from the maps library, named differentlyus_cities