centroid: Get centroid for a geo_list

View source: R/centroid.R

centroidR Documentation

Get centroid for a geo_list

Description

Get centroid for a geo_list

Usage

centroid(x, ...)

Arguments

x

An object of class geo_list

...

Ignored

Value

A vector of the form longitude, latitude

Examples

# 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)

geojsonio documentation built on Sept. 8, 2023, 5:54 p.m.