Git Product home page Git Product logo

milos-agathon / map-rivers-with-sf-and-ggplot2-in-r Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 4.0 24.07 MB

Let's make a pretty map of European rivers using the Global River Classification dataset ๐Ÿง‘๐Ÿผโ€๐Ÿ’ป Check the full tutorial at https://milospopovic.net/map-rivers-with-sf-and-ggplot2-in-r/

Home Page: https://milospopovic.net/map-rivers-with-sf-and-ggplot2-in-r/

R 100.00%
data-science data-visualization gis r rivers

map-rivers-with-sf-and-ggplot2-in-r's Introduction

map-rivers-with-sf-and-ggplot2-in-r's People

Contributors

milos-agathon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

map-rivers-with-sf-and-ggplot2-in-r's Issues

Odd issue with list.files

I'm trying to replicate for another region.

I put shp files in a directory on my computer, and adjusted the list.files call in the get)data() function appropriately, but needed to adjust the pattern for it to return the appropriate file.
using here:

library(here)

This didn't appear to work:
filenames <- list.files(path = paste0(here(), "/HydroRIVERS_v10_au_shp"), pattern="*.shp", full.names=TRUE)
This did:
filenames <- list.files(path = paste0(here(), "/HydroRIVERS_v10_au_shp"), pattern="\\.shp", full.names=TRUE)

Probably should use a $ at the end of the pattern as well:
https://stackoverflow.com/a/4876869/4927395`

This could have been a problem at my end though.

Download link for file not working

I've modified my own get_data() as below:

# Download manually from https://www.hydrosheds.org/products/hydrorivers HydroRIVERS_v10_eu_shp.zip
# or use wget in terminal
# wget https://data.hydrosheds.org/file/HydroRIVERS/HydroRIVERS_v10_eu_shp.zip

get_data <- function(url, res, filenames) {
  #unzip("HydroRIVERS_v10_eu_shp.zip") #unzip, need once only
  filenames <- list.files("HydroRIVERS_v10_eu_shp", pattern="*.shp", full.names=T)
  return(filenames)
}

Font for linux machine?

On a linux machine, comment out this:`

#windowsFonts(georg = windowsFont('Georgia'))`

modify make_map.r: by commenting out text...:

     theme(#text = element_text(family = "georg"),

And then make sure (in mainr.r) you source your local make_map.r:

# map_url <- "https://raw.githubusercontent.com/milos-agathon/map-rivers-with-sf-and-ggplot2-in-R/main/R/make_map.r"
# source(map_url) # load script
source("R/make_map.r")

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.