Tools for linting ‘GeoJSON’.
Package API:
geojson_lint() - GeoJSON lint web servicegeojson_hint() - GeoJSON hint JS librarygeojson_validate() - is-my-json-valid JS library using a GeoJSON schema from https://github.com/SchemaStore/schemastoreStable version from CRAN
install.packages("geojsonlint")Development version from GitHub
devtools::install_github("ropenscilabs/geojsonlint")library("geojsonlint")geojsonlint.com web service
geojson_lint(x = '{"type": "Point", "coordinates": [-100, 80]}')
#> [1] TRUEgeojsonhint JS library
geojson_hint(x = '{"type": "Point", "coordinates": [-100, 80]}')
#> [1] TRUEis-my-json-valid JS library
geojson_validate(x = '{"type": "Point", "coordinates": [-100, 80]}')
#> [1] TRUEgeojsonlint.com web service
geojson_lint('{"type": "FooBar"}')
#> [1] FALSEgeojsonhint JS library
geojson_hint('{"type": "FooBar"}')
#> [1] FALSEis-my-json-valid JS library
geojson_validate('{ "type": "FeatureCollection" }')
#> [1] FALSEgeojsonlint.com web service
geojson_lint('{"type": "FooBar"}', verbose = TRUE)
#> [1] FALSE
#> attr(,"errors")
#> message status
#> 1 "FooBar" is not a valid GeoJSON type. errorgeojsonhint JS library
geojson_hint('{"type": "FooBar"}', verbose = TRUE)
#> [1] FALSE
#> attr(,"errors")
#> line message
#> 1 1 The type FooBar is unknownis-my-json-valid JS library
geojson_validate('{ "type": "FeatureCollection" }', verbose = TRUE)
#> [1] FALSE
#> attr(,"errors")
#> field message
#> 1 data no (or more than one) schemas matchgeojsonlint.com web service
geojson_lint('{"type": "FooBar"}', error = TRUE)
#> Error: invalid GeoJSON
#> - "FooBar" is not a valid GeoJSON type.geojsonhint JS library
geojson_hint('{"type": "FooBar"}', error = TRUE)
#> Error: Line 1
#> - The type FooBar is unknownis-my-json-valid JS library
geojson_validate('{ "type": "FeatureCollection" }', error = TRUE)
#> Error: 1 error validating json:
#> - data: no (or more than one) schemas match