Learn R Programming

geoops (version 0.3.0)

geo_get_coords: Get coordinates

Description

Get coordinates

Usage

geo_get_coords(x)

Arguments

x

geojson string

Value

a character vector with coordinates as JSON

Details

You can use jsonlite to convert the output to R objects

Examples

Run this code
# NOT RUN {
x <- '{"type": "Feature", "geometry": {"type": "Point","coordinates": [1, 2]},"properties": {}}'
geo_get_coords(x)
x <- '{"type": "Point", "coordinates": [1, 2]}'
geo_get_coords(x)
x <- '[0, 5]'
geo_get_coords(x)
# }

Run the code above in your browser using DataLab