diff --git a/08-read-write-plot.md b/08-read-write-plot.md index e138540..5e9c008 100644 --- a/08-read-write-plot.md +++ b/08-read-write-plot.md @@ -33,7 +33,7 @@ read_sf #> st_read(..., quiet = quiet, stringsAsFactors = stringsAsFactors, #> as_tibble = as_tibble) #> } -#> +#> #> nc = st_read(system.file("shape/nc.shp", package="sf")) #> Reading layer `nc' from data source diff --git a/09-mapping.md b/09-mapping.md index c502cbc..edfe053 100644 --- a/09-mapping.md +++ b/09-mapping.md @@ -34,9 +34,10 @@ nlcd = rast(system.file("raster/nlcd.tif", package = "spDataLarge")) ``` E1. Create a map showing the geographic distribution of the Human Development Index (`HDI`) across Africa with base **graphics** (hint: use `plot()`) and **tmap** packages (hint: use `tm_shape(africa) + ...`). - - Name two advantages of each based on the experience. - - Name three other mapping packages and an advantage of each. - - Bonus: create three more maps of Africa using these three other packages. + +- Name two advantages of each based on the experience. +- Name three other mapping packages and an advantage of each. +- Bonus: create three more maps of Africa using these three other packages. ```r # graphics @@ -44,7 +45,7 @@ plot(africa["HDI"]) # tmap remotes::install_github("r-tmap/tmap") #> Using github PAT from envvar GITHUB_PAT. Use `gitcreds::gitcreds_set()` and unset GITHUB_PAT in .Renviron (or elsewhere) if you want to use the more secure git credential store instead. -#> Skipping install of 'tmap' from a github remote, the SHA1 (944fa941) has not changed since last install. +#> Skipping install of 'tmap' from a github remote, the SHA1 (6162aa32) has not changed since last install. #> Use `force = TRUE` to force installation library(tmap) #> @@ -78,7 +79,7 @@ ggplotly(g) ```{=html}
- + # mapsf library(mapsf) mf_map(x = africa, var = "HDI", type = "choro") @@ -117,15 +118,17 @@ ahdi = tm_shape(africa) + values = "-viridis"), fill.legend = tm_legend(title = "Human Development Index:")) tmap_arrange(ahdi, asubregions) +#> [cols4all] color palettes: use palettes from the R package cols4all. Run 'cols4all::c4a_gui()' to explore them. The old palette name "Set3" is named "set3" (in long format "brewer.set3") #> Multiple palettes called "set3 found: "brewer.set3", "hcl.set3". The first one, "brewer.set3", is returned. ``` E4. Create a land cover map of the Zion National Park. - - Change the default colors to match your perception of the land cover categories - - Add a scale bar and north arrow and change the position of both to improve the map's aesthetic appeal - - Bonus: Add an inset map of Zion National Park's location in the context of the Utah state. (Hint: an object representing Utah can be subset from the `us_states` dataset.) + +- Change the default colors to match your perception of the land cover categories +- Add a scale bar and north arrow and change the position of both to improve the map's aesthetic appeal +- Bonus: Add an inset map of Zion National Park's location in the context of the Utah state. (Hint: an object representing Utah can be subset from the `us_states` dataset.) ```r tm_shape(nlcd) + @@ -197,8 +200,9 @@ print(inset, vp = ins_vp) E5. Create facet maps of countries in Eastern Africa: - - With one facet showing HDI and the other representing population growth (hint: using variables `HDI` and `pop_growth`, respectively) - - With a 'small multiple' per country + +- With one facet showing HDI and the other representing population growth (hint: using variables `HDI` and `pop_growth`, respectively) +- With a 'small multiple' per country ```r ea = subset(africa, subregion == "Eastern Africa") @@ -214,8 +218,9 @@ tm_shape(ea) + E6. Building on the previous facet map examples, create animated maps of East Africa: - - Showing each country in order - - Showing each country in order with a legend showing the HDI + +- Showing each country in order +- Showing each country in order with a legend showing the HDI ```r tma1 = tm_shape(ea) + @@ -236,10 +241,11 @@ browseURL("tma2.gif") ``` E7. Create an interactive map of HDI in Africa: - - With **tmap** - - With **mapview** - - With **leaflet** - - Bonus: For each approach, add a legend (if not automatically provided) and a scale bar + +- With **tmap** +- With **mapview** +- With **leaflet** +- Bonus: For each approach, add a legend (if not automatically provided) and a scale bar ```r # tmap @@ -259,9 +265,10 @@ leaflet(africa4326) |> ``` E8. Sketch on paper ideas for a web mapping app that could be used to make transport or land-use policies more evidence based: - - In the city you live, for a couple of users per day - - In the country you live, for dozens of users per day - - Worldwide for hundreds of users per day and large data serving requirements + +- In the city you live, for a couple of users per day +- In the country you live, for dozens of users per day +- Worldwide for hundreds of users per day and large data serving requirements Ideas could include identification of routes where many people currently drive short distances, ways to encourage access to parks, or prioritization of new developments to reduce long-distance travel. @@ -272,8 +279,9 @@ A the national level a mapping application, e.g., with shiny, would probably be Worldwide, a database to serve the data would likely be needed. Then various front-ends could plug in to this. E9. Update the code in `coffeeApp/app.R` so that instead of centering on Brazil the user can select which country to focus on: - - Using `textInput()` - - Using `selectInput()` + +- Using `textInput()` +- Using `selectInput()` The answer can be found in the `shinymod` branch of the geocompr repo: https://github.com/Robinlovelace/geocompr/pull/318/files You create the new widget and then use it to set the center. diff --git a/404.html b/404.html index a1690de..b8ae695 100644 --- a/404.html +++ b/404.html @@ -77,7 +77,7 @@

## Warning: The 'main.title' argument of 'tm_layout()' is deprecated as of tmap
 ## 4.0. Please use 'tm_title()' instead.
-
+
@@ -99,7 +99,7 @@

Note: Second Edition is under construction 🏗