Artistic town street map made with osmdata
and ggplot2
Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright
Artistic town street map made with Open Street Map data and ggplot2
License: GNU General Public License v3.0
Artistic town street map made with osmdata
and ggplot2
Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright
Hey @deanmarchiori, great map, great code, and I'm chuffed that you're using my packages to create such beautiful results! If i may, the following reprex
shows a few slightly more efficient ways to get your end result, particularly by removing all of the sf
manipulations and the hand-selection of osm_id
values. These can simply be replaced by the dodgr ability to select the largest connected component, which is what you want here. The only actual coordinate manipulation then necessary is to trim the data from the far east, so the single coordinate enters in the form of xmin
. (Note that you might be latest dev versions of both osmdata
and dodgr
for this to work flawlessly.)
library (dplyr)
library (forcats)
library (ggplot2)
library (osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library (dodgr)
streets_raw <- opq ("culburra beach, NSW, Australia") %>%
add_osm_feature (key = "highway") %>%
osmdata_sf () %>%
osm_poly2line ()
xmin <- 150.74
streets_raw <- weight_streetnet (streets_raw$osm_lines) %>%
filter (component == 1) %>%
filter (from_lon > xmin & to_lon > xmin) %>%
dodgr_to_sf ()
#> Loading required namespace: sf
streets <- streets_raw %>%
select(edge_id, highway) %>%
mutate(highway = fct_recode(highway,
residential = "service",
residential = "unclassified",
path = "track",
path = "cycleway"
))
ggplot(streets, aes(col = highway)) +
geom_sf(data = filter(streets, highway == 'path'), alpha = 0.4, show.legend = F) +
geom_sf(data = filter(streets, highway == 'residential'), alpha = 0.5, show.legend = F) +
geom_sf(data = filter(streets, highway == 'secondary'), alpha = 0.9, show.legend = F) +
scale_colour_manual(values = c("path" = "#70838B",
"residential" = "#0A5D81",
"secondary" = "#0A5D81")) +
labs(caption = "Culburra Beach",
y = "") +
#expand_limits(y = c(-34.8980, -34.9482)) +
theme_minimal() +
theme(
plot.background = element_rect(fill = "#E4D9C6", color = NA),
panel.background = element_rect(fill = "#E4D9C6", color = NA),
panel.grid = element_blank(),
axis.text = element_text(colour = "#C7B18A", family = "Ubuntu Mono"),
axis.ticks = element_blank(),
panel.border = element_blank(),
plot.caption = element_text(family = "Ubuntu Mono", size = 85, vjust = -0.2, color = '#C7B18A'),
plot.margin = margin(22,10,22,10, "mm"))
Created on 2020-02-04 by the reprex package (v0.3.0)
Great work! And feel free to close this immediately and ignore it, as your map has obviously already been generated ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.