Skip to content

Instantly share code, notes, and snippets.

@halhen
Last active November 4, 2020 16:11
Show Gist options
  • Save halhen/793735b47926f16321a84d98cc527667 to your computer and use it in GitHub Desktop.
Save halhen/793735b47926f16321a84d98cc527667 to your computer and use it in GitHub Desktop.
# Download elevation tif from eg http://www.eea.europa.eu/data-and-maps/data/digital-elevation-model-of-europe
# First, convert elevation tif to a space delimited xyz (lng lat elevation) file
# $ gdal_translate -of XYZ elevation3x3.tif /tmp/file.xyz
df <- read_delim('/tmp/file.xyz', delim=' ', col_names=FALSE)
df %>%
mutate(X3 = na_if(X3, 0)) %>%
ggplot(aes(X1, -X2 + 20 * X3/max(X3, na.rm=TRUE), group=X2)) +
geom_line(size=0.05) +
ggthemes::theme_map() +
coord_equal(0.9)
ggsave('/tmp/map.png', width=10, height=10)
@halhen
Copy link
Author

halhen commented Apr 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment