make_tidy_poly: Turns a spatial object into a tidy tibble

Description Usage Arguments Value Examples

Description

This will then work with ggplot2

Usage

1
make_tidy_poly(spatial)

Arguments

spatial

an object of class SpatialPolygonsDataFrame

Value

tibble

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(geoDK)
library(ggplot2)

geo_reg <- geo_get_spatial("Danish regions")

df <- make_tidy_poly(geo_reg)

ggplot(df) +
  geom_polygon(aes(x = lng, y = lat, group = area, fill = regionkode),
               show.legend = FALSE) +
  coord_cartesian()

mikkelkrogsholm/geoDK documentation built on May 16, 2019, 2:53 a.m.