add_markers.Rd
Add markers to a google map
add_markers(map, data = get_map_data(map), id = NULL, colour = NULL, lat = NULL, lon = NULL, polyline = NULL, title = NULL, draggable = NULL, opacity = NULL, label = NULL, info_window = NULL, mouse_over = NULL, mouse_over_group = NULL, marker_icon = NULL, layer_id = NULL, cluster = FALSE, update_map_view = TRUE, digits = 4, load_interval = 0, focus_layer = FALSE, close_info_window = FALSE)
map | a googleway map object created from |
---|---|
data | data frame containing the data to use in the layer. If Null, the
data passed into |
id | string specifying the column containing an identifier for a shape |
colour | string specifying the column containing the 'colour' to use for the markers. One of 'red', 'blue', 'green' or 'lavender'. |
lat | string specifying the column of |
lon | string specifying the column of |
polyline | string specifying the column of |
title | string specifying the column of |
draggable | string specifying the column of |
opacity | string specifying the column of |
label | string specifying the column of |
info_window | string specifying the column of data to display in an info window when a shape is clicked. |
mouse_over | string specifying the column of data to display when the mouse rolls over the shape |
mouse_over_group | string specifying the column of data specifying which groups of shapes to highlight on mouseover |
marker_icon | string specifying the column of data containing a link/URL to an image to use for a marker |
layer_id | single value specifying an id for the layer. Use this value to
distinguish between shape layers for when using any |
cluster | logical indicating if co-located markers should be clustered when the map zoomed out |
update_map_view | logical specifying if the map should re-centre according to the shapes |
digits | integer. Use this parameter to specify how many digits (decimal places) should be used for the latitude / longitude coordinates. |
load_interval | time in miliseconds to wait between plotting each shape |
focus_layer | logical indicating if the map should re-centre according to this layer |
close_info_window | logical indicating if all |
# NOT RUN { map_key <- "your api key" google_map(key = map_key, data = tram_stops) %>% add_markers(lat = "stop_lat", lon = "stop_lon", info_window = "stop_name") ## using marker icons iconUrl <- paste0("https://developers.google.com/maps/documentation/", "javascript/examples/full/images/beachflag.png") tram_stops$icon <- iconUrl google_map(key = map_key, data = tram_stops) %>% add_markers(lat = "stop_lat", lon = "stop_lon", marker_icon = "icon") # }