cartographer: Create a cartographer map

View source: R/cartographer.R

cartographerR Documentation

Create a cartographer map

Description

This function creates a new instance of a d3-carto-map and sets its most basic options. By itself the function does not create any layers on the map.

Usage

cartographer(region = NULL, bbox = NULL, width = NULL, height = NULL,
  browser = FALSE)

Arguments

region

The region to which the map should be centered. This region can be one of several types. Passing a two-letter ISO country code will center the map on that country. The string "United States" will center the map on the continental United States of America. You can also use the names of continents. The region is case insensitive.

bbox

Instead of a region, you can center the map on a bounding box. The bounding box be specified in decimal degrees of latitude and longitude and should have the following format: list(c(long1, lat1), c(long2, lat2))

width

The width of the map in pixels.

height

The height of the map in pixels.

browser

Where to display the map. If TRUE, always display in the browser. Otherwise, display in the RStudio Viewer if available.

See Also

points_layer, tile_layer, topojson_layer

Examples

if(require(historydata)) {
  cartographer(region = "United States") %>%
    tile_layer() %>%
    points_layer(catholic_dioceses, x = "long", y = "lat")
}

ropensci/cartographer documentation built on May 18, 2022, 9:49 a.m.