
Map of Oslo wards (bydeler) in data.table format
Source:R/data_oslo_ward.R
oslo_ward_map_bxxxx_default_dt.RdWe package the map datasets for Oslo wards (bydeler), taken from Oslo municipality, so that you can draw them in ggplot2 with no geolibrary. This data is licensed under Creative Commons BY 4.0 (CC BY 4.0).
Usage
oslo_ward_map_b2024_default_dt
oslo_ward_map_b2020_default_dt
oslo_ward_position_geolabels_b2024_default_dt
oslo_ward_position_geolabels_b2020_default_dtFormat
oslo_ward_map_b2024_default_dt and
oslo_ward_map_b2020_default_dt are data.tables with one row per
polygon vertex:
- long
Longitude in decimal degrees (WGS84).
- lat
Latitude in decimal degrees (WGS84).
- order
Integer draw order carried over from the source polygon conversion.
ggplot2::geom_polygon()follows row order, so you rarely need this column.- group
Factor, one level per closed polygon ring; use as the
groupaesthetic in ggplot2. Here each ward has exactly one ring.- location_code
Ward code (e.g.
"wardoslo_nor030101").
oslo_ward_position_geolabels_b2024_default_dt and
oslo_ward_position_geolabels_b2020_default_dt are data.tables
with one row per ward. They carry no repel column, unlike the county
label datasets:
- location_code
Ward code (e.g.
"wardoslo_nor030101").- long
Longitude in decimal degrees (WGS84) of the label anchor.
- lat
Latitude in decimal degrees (WGS84) of the label anchor.
An object of class data.table (inherits from data.frame) with 1372 rows and 5 columns.
An object of class data.table (inherits from data.frame) with 15 rows and 3 columns.
An object of class data.table (inherits from data.frame) with 15 rows and 3 columns.
Details
Borders provided for 2024, 2020. Both hold the 15 wards
wardoslo_nor030101 to wardoslo_nor030115, one closed polygon
ring each. The 2024 and 2020 objects are identical, for the maps and for the
label datasets alike. Only the default layout is provided; there is no
insert-Oslo or split ward map.
Each border year has a polygon table (oslo_ward_map_*) and a label
table (oslo_ward_position_geolabels_*). The two hold the same set of
location_code values, but different columns.
See also
vignette("layout", package = "csmaps") draws
oslo_ward_map_b2024_default_dt, and
vignette("customization", package = "csmaps") labels it with
oslo_ward_position_geolabels_b2024_default_dt. No vignette uses the
2020 datasets.
Other Oslo ward maps:
oslo_ward_map_bxxxx_default_sf
Examples
# 2024 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
data = csmaps::oslo_ward_map_b2024_default_dt,
mapping = aes(group = group, fill = location_code),
color = "black",
fill = "white",
linewidth = 0.4
)
q <- q + geom_label(
data = csmaps::oslo_ward_position_geolabels_b2024_default_dt,
mapping = aes(label = location_code),
color = "red"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q
# 2020 borders
library(ggplot2)
q <- ggplot(mapping = aes(x = long, y = lat))
q <- q + geom_polygon(
data = csmaps::oslo_ward_map_b2020_default_dt,
mapping = aes(group = group, fill = location_code),
color = "black",
fill = "white",
linewidth = 0.4
)
q <- q + geom_label(
data = csmaps::oslo_ward_position_geolabels_b2020_default_dt,
mapping = aes(label = location_code),
color = "red"
)
q <- q + theme_void()
q <- q + coord_quickmap()
q