Introduction to geojsonlint

knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE,
  warning = FALSE, 
  message = FALSE
)

Tools for linting 'GeoJSON'.

GeoJSON linters available in geojsonlint

Install

Stable version from CRAN

install.packages("geojsonlint")

Development version from GitHub

remotes::install_github("ropensci/geojsonlint")
library("geojsonlint")

Good GeoJSON

geojsonhint JS library

geojson_hint(x = '{"type": "Point", "coordinates": [-100, 80]}')

is-my-json-valid JS library

geojson_validate(x = '{"type": "Point", "coordinates": [-100, 80]}')

Bad GeoJSON

geojsonhint JS library

geojson_hint('{"type": "FooBar"}')

is-my-json-valid JS library

geojson_validate('{ "type": "FeatureCollection" }')

Bad GeoJSON - with reason for failure

geojsonhint JS library

geojson_hint('{"type": "FooBar"}', inform = TRUE)

is-my-json-valid JS library

geojson_validate('{ "type": "FeatureCollection" }', inform = TRUE)

Bad GeoJSON - stop on validation failure

geojsonhint JS library

geojson_hint('{"type": "FooBar"}', error = TRUE)
#> Error: Line 1
#>    - The type FooBar is unknown

is-my-json-valid JS library

geojson_validate('{ "type": "FeatureCollection" }', error = TRUE)
#> Error: 1 error validating json:
#>  - data: no (or more than one) schemas match


Try the geojsonlint package in your browser

Any scripts or data that you put into this service are public.

geojsonlint documentation built on Feb. 13, 2020, 9:06 a.m.