Git Product home page Git Product logo

culburra's Introduction

culburra's People

Contributors

deanmarchiori avatar deanmarchiori-ee avatar

Stargazers

Wenbo Lv avatar  avatar Kevin Brown avatar John MacKintosh avatar Francisco Rodriguez-Sanchez avatar Darek Kedra avatar Najko Jahn avatar Bea avatar Mike N avatar Petr Bouchal avatar Andrew Heiss avatar Love Hansson avatar A. Domingues avatar Josh Fangmeier avatar Mitchell Gritts avatar Ruì avatar Jan Simson avatar Rhian Davies avatar Marijn Boer avatar M. Amalan avatar Normand Cyr avatar Santiago Mota avatar Sean Fischer avatar Peter Hickey avatar  avatar Mitch Stares avatar Evan Canfield avatar Richard Paquin Morel avatar Travis Dawry avatar mark padgham avatar Brian Knaus avatar Roberto Salas avatar Ryan Wesslen avatar Adam H. Sparks avatar

Watchers

James Cloos avatar  avatar

culburra's Issues

a slightly modified approach

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 ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.