Learn R Programming

geojson (version 0.3.5)

to_geojson: Convert GeoJSON character string to approriate GeoJSON class

Description

Automatically detects and adds the class

Usage

to_geojson(x)

Arguments

x

GeoJSON character string

Examples

Run this code
mp <- '{"type":"MultiPoint","coordinates":[[100,0],[101,1]]}'
to_geojson(mp)

ft <- '{"type":"Feature","properties":{"a":"b"},
"geometry":{"type": "MultiPoint","coordinates": [ [100.0, 0.0], [101.0, 1.0] ]}}'
to_geojson(mp)

fc <- '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"a":"b"},
"geometry":{"type": "MultiPoint","coordinates": [ [100.0, 0.0], [101.0, 1.0] ]}}]}'
to_geojson(fc)

Run the code above in your browser using DataLab