Create a city view showcasing a particular city or region using OpenStreetMap (OSM) data retreived trough the Overpass API. Please note that OpenStreetMap is open data and can be freely utilized for any purpose, as long as proper credit is given to OpenStreetMap and its contributors.
cityview(
name = NULL,
zoom = 1,
theme = c(
"vintage", "modern", "bright", "delftware", "comic",
"rouge", "original", "midearth", "batik", "vice"
),
border = c(
"none", "circle", "rhombus", "square",
"hexagon", "octagon", "decagon", "bbox"
),
halftone = NULL,
legend = FALSE,
places = 0,
license = TRUE,
timeout = 25,
filename = NULL,
verbose = TRUE,
cache = TRUE,
bot = FALSE
)
a character specifying the name of the city as provided by
list_cities()
, an object created using
new_city()
, or a row of the ouput of
list_cities()
. If NULL
(default), chooses a
random city.
a numeric value specifying the amount of zoom. Values > 1 increase zoom and speed up computation time, while values < 1 decrease zoom and increase computation time. For zoom levels below 0.5, the computation time can be very long.
a character specifying the theme of the plot, or a named list
specifying a custom theme (see the details section for more
information about the composition of this list). Possible
pre-specified themes are vintage
(default),
modern
, bright
, delftware
, comic
,
rouge
, original
, midearth
, batik
and vice
.
a character specifying the type of border to use. Possible
options are none
(default), circle
,
rhombus
, square
, hexagon
(6 vertices),
octagon
(8 vertices), decagon
(10 vertices) and
bbox
(the bounding box for the entire city, argument
zoom
will be ignored).
a character specifying the color of applied halftone dither.
logical. Whether to add a distance measurer and a compass in the bottom left corner of the image.
an integer specifying how many suburb, quarter and neighbourhood names to add to the image.
logical. Whether to add the OpenStreetMap licence in the bottom right corner of the figure.
a value specifying the timeout (in seconds) for the Overpass
server. It may be necessary to increase this value for large
or populated areas because the server may time out before all
data are delivered (if this occurs you will receive the
following error message: runtime error: Query timed out
in "recurse" at line ... after ... seconds
.
character. If specified, the function exports the plot at an
appropriate size and does not return a ggplot2
object.
logical. Whether to show a progress bar during execution.
logical. Whether to cache the data for the image so that they do not need to be requested again when calling the function with a different theme.
logical. Enable functionality used by the Twitter bot.
The theme
argument can take a custom list as input (see the
example). This list must contain all of the following elements:
colors
background
: A single color to be used for the background.
water
: A single color to be used for the water.
landuse
: A single color or a vector of multiple colors to
be used for the landuse.
contours
: A single color to be used for the contours (lines)
of landuse and buildings.
streets
: A single color to be used for the streets.
rails
: A single color or a vector of two colors to be
used for the rails.
buildings
: A single color or a vector of multiple colors to
be used for the buildings.
text
: A single color to be used for the text.
font
family
: A string specifying the family of the font.
face
: A string specifying the face of the font.
scale
: A single value specifying the expansion factor of
the characters in the font.
append
: Optional. A string to append the city name with at
both sides.
size
borders
: A named list containing sizes for the borders
contours
, water
, canal
and
river
.
streets
: A named list contianing sizes for the streets
path
, residential
, structure
,
tertiary
, secondary
, primary
,
motorway
, rails
and runway
.
if (FALSE) { # \dontrun{
# 1. Simple example
# Create a city view of Amsterdam in a circle
cityview(name = "Amsterdam", border = "circle")
# 2. Advanced example
# Custom theme (black, beige and white), streets only, direct export
myTheme <- list(
colors = list(
background = "#232323",
water = "#232323",
landuse = "#232323",
contours = "#232323",
streets = "#d7b174",
rails = c("#d7b174", "#232323"),
buildings = "#232323",
text = "#ffffff",
waterlines = "#232323"
),
font = list(
family = "serif",
face = "bold",
scale = 1,
append = "\u2014"
),
size = list(
borders = list(
contours = 0.15,
water = 0.4,
canal = 0.5,
river = 0.6
),
streets = list(
path = 0.2,
residential = 0.3,
structure = 0.35,
tertiary = 0.4,
secondary = 0.5,
primary = 0.6,
motorway = 0.8,
rails = 0.75,
runway = 3
)
)
)
cityview(
name = "Amsterdam", theme = myTheme,
border = "square", filename = "Amsterdam.png"
)
} # }