50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

mapboxapi (version 0.5)

prep_overlay_markers: Prepare overlay markers for use in a Mapbox static map

Description

Markers are prepared to match GeoJSON marker-spec which is a partial implementation of the GeoJSON simplestyle-spec (described as a work-in-progress by Mapbox).

Usage

prep_overlay_markers(
  data = NULL,
  marker_type = c("pin-s", "pin-l", "url"),
  label = NA,
  color = NA,
  longitude = NULL,
  latitude = NULL,
  url = NA
)

Value

A formatted list of marker specifications that can be passed to the static_mapbox function.

Arguments

data

An input data frame with longitude and latitude columns (X and Y or lon and lat as names are also acceptable) or an sf object with geometry type POINT.

marker_type

The marker type; one of "pin-s", for a small pin; "pin-l", for a large pin; and "url", for an image path.

label

The marker label (optional). Can be a letter, number (0 through 99), or a valid Maki icon (see https://labs.mapbox.com/maki-icons/) for options).

color

The marker color (optional). Color should be specified as a three or six-digit hexadecimal code without the number sign.

longitude

A vector of longitudes; inferred from the input dataset if data is provided.

latitude

A vector of latitudes; inferred from the input dataset if data is provided.

url

The URL of the image to be used for the icon if marker_type = "url".