Skip to contents

Automatically detects and adds the class

Usage

to_geojson(x)

Arguments

x

GeoJSON character string

Examples

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

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

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