Skip to contents

Is it a GeoJSON geometry?

Usage

is_geojson(x)

Arguments

x

A character vector.

Value

Logical vector; TRUE for a JSON object carrying a GeoJSON "type" (Point, Polygon, Feature, FeatureCollection, ...) together with a "coordinates", "geometry", "geometries", or "features" member. Structural (regex) check, not a full JSON parse.

See also

Other geometry detectors: is_wkb(), is_wkt_geometry()

Examples

is_geojson(c('{"type":"Point","coordinates":[30,10]}', "{}", NA))
#> [1]  TRUE FALSE    NA