Convert a data object to a Mapbox GeoJSON source
1 2 3 4 5 6 7 8 9 10 11 | as_mapbox_source(data, ...)
## S3 method for class 'json'
as_mapbox_source(data, ...)
## S3 method for class 'data.frame'
as_mapbox_source(data, lng = "lng", lat = "lat",
...)
## S3 method for class 'sf'
as_mapbox_source(data, ...)
|
data |
A data frame that contains longitudes and latitudes in separate columns
or an |
... |
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. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.