Convert a data object to a Mapbox GeoJSON source

as_mapbox_source(data, ...)

# S3 method for json
as_mapbox_source(data, ...)

# S3 method for data.frame
as_mapbox_source(data, lng = "lng", lat = "lat",
  ...)

# S3 method for sf
as_mapbox_source(data, ...)

Arguments

data

A data frame that contains longitudes and latitudes in separate columns or an sf-object.

...

The properties of the source. See https://docs.mapbox.com/mapbox-gl-js/style-spec/sources for available options for the given source type.

lng

The name of the column containing the longitudes.

lat

The name of the column containing the latitudes.