TITLE: Making arty renders of Belize's rivers DATE: 2018-07-01 AUTHOR: John L. Godlee ==================================================================== y partner spends a lot of time in Belize for work and was looking for something to hang on her wall as a piece of art. I thought that a stylised map of Belize could make a nice minimalist piece of art, but because I have no artistic skills, I decided to do it using R. I got some shapefiles to start with: - A simple global river bankfull width and depth database - For the rivers - GADM Data - Outline of Belize [A simple global river bankfull width and depth database]: https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/wrcr.20440 [GADM Data]: https://gadm.org/download_country_v3.html I also experimented with other shapefiles of rivers in Belize, but the one above is the one I preferred, mainly because it has slightly angular lines. These are the other sources I looked at: - Meerman 2015 - Digital Chart of the World - Inland Water [Meerman 2015]: http://www.biodiversity.bz/ [Digital Chart of the World - Inland Water]: http://www.diva-gis.org/gdata ![Map comparison](https://johngodlee.xyz/img_full/belize_rivers/examples.j pg) Here is the R code that I used to create the map output. I saved it as an svg for printing and also as a png for previewing: # Packages ---- library(rgdal) library(raster) # Add shapefiles ---- belize <- readOGR(dsn = "BLZ_adm", layer = "BLZ_adm0") rivers_1 <- readOGR(dsn = "camerica", layer = "carivs") rivers_2 <- readOGR(dsn = "Belize_Rivers 2", layer = "Belize_Rivers") rivers_3 <- readOGR(dsn = "BLZ_wat", layer = "BLZ_water_lines_dcw") watersheds <- readOGR(dsn = "Belize_Watersheds", layer = "Belize_Watersheds") # Fix shapefiles ---- ## Transform rivers_2 to wgs84 CRS rivers_2_wgs84 <- spTransform(rivers_2, CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")) # rivers_1 ---- ## Filter out rivers not in Belize rivers_1_belize <- crop(rivers_1, belize) ## Save as .svg svg(filename = "img/svg/rivers_1_belize.svg", width = 15, height = 20, onefile = TRUE) plot(rivers_1_belize) plot(belize, add = TRUE) dev.off() ## Filter out small rivers according to bank full width rivers_1_big <- rivers_1_belize[rivers_1_belize$a_WIDTH > quantile(rivers_1_belize$a_WIDTH, 0.50), ] ## Save as .svg svg(filename = "img/svg/rivers_1_big.svg", width = 15, height = 20, onefile = TRUE) plot(rivers_1_big) plot(belize, add = TRUE) dev.off() # rivers_2 ---- ## Filter streams that are more than 2nd order, or 3rd order rivers_2_first <- rivers_2_wgs84[rivers_2_wgs84$Strm_order > 1, ] rivers_2_second <- rivers_2_wgs84[rivers_2_wgs84$Strm_order > 2, ] ## Crop to belize outline rivers_2_first_belize <- crop(rivers_2_first, belize) rivers_2_second_belize <- crop(rivers_2_second, belize) ## Write as shapefiles because the cropping took a long time writeOGR(obj=rivers_2_first_belize, dsn="belize_rivers_2_first_crop", layer="belizer_rivers_2_first_crop", driver="ESRI Shapefile") writeOGR(obj=rivers_2_second_belize, dsn="belize_rivers_2_second_crop", layer="belizer_rivers_2_second_crop", driver="ESRI Shapefile") ## Save as .svg svg(filename = "img/svg/rivers_2_wgs84.svg", width = 15, height = 20, onefile = TRUE) plot(rivers_2_wgs84) plot(belize, add = TRUE) dev.off() svg(filename = "img/svg/rivers_2_first_belize.svg", width = 15, height = 20, onefile = TRUE) plot(rivers_2_first_belize) plot(belize, add = TRUE) dev.off() svg(filename = "img/svg/rivers_2_second_belize.svg", width = 15, height = 20, onefile = TRUE) plot(rivers_2_second_belize) plot(belize, add = TRUE) dev.off() # rivers 3 ---- ## Save as .svg svg(filename = "img/svg/rivers_3.svg", width = 15, height = 20, onefile = TRUE) plot(rivers_3) plot(belize, add = TRUE) dev.off() I'm printing off the big file next week, then I want to frame it in a thin black edge frame with glossy glass. ![Best map](https://johngodlee.xyz/img_full/belize_rivers/rivers_1_belize.p ng)