Get centroid for a geo_list

Share:

Description

Get centroid for a geo_list

Usage

1

Arguments

x

An object of class geo_list

...

Ignored

Value

A vector of the form longitude, latitude

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# numeric
vec <- c(-99.74,32.45)
x <- geojson_list(vec)
centroid(x)

# list
mylist <- list(list(latitude=30, longitude=120, marker="red"),
               list(latitude=30, longitude=130, marker="blue"))
x <- geojson_list(mylist)
centroid(x)

# data.frame
x <- geojson_list(states[1:20,])
centroid(x)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.