Skip to content

Commit 446c670

Browse files
committed
Deploy commit: Type out -> type e05b594
1 parent d939aeb commit 446c670

15 files changed

+63
-57
lines changed

11-algorithms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ E1. Read the script [`11-centroid-alg.R`](https://github.com/geocompx/geocompr/b
452452

453453
E2. In the geometric algorithms section, we calculated that the area of the polygon `poly_mat` was 245 units squared and that its centroid as at the coordinates (8.8, 9.2).
454454

455-
- Reproduce the results on your own computer with reference to the script [`11-centroid-alg.R`](https://github.com/geocompx/geocompr/blob/main/code/11-centroid-alg.R), an implementation of this algorithm (bonus: type out the commands - try to avoid copy-pasting).
455+
- Reproduce the results on your own computer with reference to the script [`11-centroid-alg.R`](https://github.com/geocompx/geocompr/blob/main/code/11-centroid-alg.R), an implementation of this algorithm (bonus: type the commands - try to avoid copy-pasting).
456456
- Are the results correct? Verify them by converting `poly_mat` into an `sfc` object (named `poly_sfc`) with `st_polygon()` (hint: this function takes objects of class `list()`) and then using `st_area()` and `st_centroid()`.
457457

458458

13-transport.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ routes_short_scenario = routes_short |>
570570
mutate(bicycle = bicycle + car_driver * uptake,
571571
car_driver = car_driver * (1 - uptake))
572572
sum(routes_short_scenario$bicycle) - sum(routes_short$bicycle)
573-
#> [1] 1105
573+
#> [1] 1023
574574
```
575575

576576
Having created a scenario in which approximately 4000 trips have switched from driving to cycling, we can now model where this updated modeled cycling activity will take place.
@@ -643,6 +643,11 @@ ways_centrality = ways_sfn |>
643643
mutate(betweenness = tidygraph::centrality_edge_betweenness(lengths))
644644
```
645645

646+
647+
```
648+
#> [plot mode] legend/component: Some components or legends are too wide and are therefore rescaled. Set the tmap option 'component.autoscale' to FALSE to disable rescaling.
649+
```
650+
646651
<div class="figure" style="text-align: center">
647652
<img src="figures/wayssln-1.png" alt="Illustration of route network datasets. The grey lines represent a simplified road network, with segment thickness proportional to betweenness. The green lines represent potential cycling flows (one way) calculated with the code above." width="100%" />
648653
<p class="caption">(\#fig:wayssln)Illustration of route network datasets. The grey lines represent a simplified road network, with segment thickness proportional to betweenness. The green lines represent potential cycling flows (one way) calculated with the code above.</p>

algorithms.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ <h2>
468468
</ul>
469469
<p>E2. In the geometric algorithms section, we calculated that the area of the polygon <code>poly_mat</code> was 245 units squared and that its centroid as at the coordinates (8.8, 9.2).</p>
470470
<ul>
471-
<li>Reproduce the results on your own computer with reference to the script <a href="https://github.com/geocompx/geocompr/blob/main/code/11-centroid-alg.R"><code>11-centroid-alg.R</code></a>, an implementation of this algorithm (bonus: type out the commands - try to avoid copy-pasting).</li>
471+
<li>Reproduce the results on your own computer with reference to the script <a href="https://github.com/geocompx/geocompr/blob/main/code/11-centroid-alg.R"><code>11-centroid-alg.R</code></a>, an implementation of this algorithm (bonus: type the commands - try to avoid copy-pasting).</li>
472472
<li>Are the results correct? Verify them by converting <code>poly_mat</code> into an <code>sfc</code> object (named <code>poly_sfc</code>) with <code><a href="https://r-spatial.github.io/sf/reference/st.html">st_polygon()</a></code> (hint: this function takes objects of class <code><a href="https://rdrr.io/r/base/list.html">list()</a></code>) and then using <code><a href="https://r-spatial.github.io/sf/reference/geos_measures.html">st_area()</a></code> and <code><a href="https://r-spatial.github.io/sf/reference/geos_unary.html">st_centroid()</a></code>.</li>
473473
</ul>
474474
<p>E3. It was stated that the algorithm we created only works for <em>convex hulls</em>. Define convex hulls (see the geometry operations chapter) and test the algorithm on a polygon that is <em>not</em> a convex hull.</p>

conclusion.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ <h2>
132132
</h2>
133133
<p>A feature of R, and open source software in general, is that there are often multiple ways to achieve the same result.
134134
The code chunk below illustrates this by using three functions, covered in Chapters <a href="attr.html#attr">3</a> and <a href="geometry-operations.html#geometry-operations">5</a>, to combine the 16 regions of New Zealand into a single geometry:</p>
135-
<div class="sourceCode" id="cb511"><pre class="downlit sourceCode r">
135+
<div class="sourceCode" id="cb512"><pre class="downlit sourceCode r">
136136
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://jakubnowosad.com/spData/">spData</a></span><span class="op">)</span></span>
137137
<span><span class="va">nz_u1</span> <span class="op">=</span> <span class="fu">sf</span><span class="fu">::</span><span class="fu"><a href="https://r-spatial.github.io/sf/reference/geos_combine.html">st_union</a></span><span class="op">(</span><span class="va">nz</span><span class="op">)</span></span>
138138
<span><span class="va">nz_u2</span> <span class="op">=</span> <span class="fu"><a href="https://rspatial.github.io/terra/reference/aggregate.html">aggregate</a></span><span class="op">(</span><span class="va">nz</span><span class="op">[</span><span class="st">"Population"</span><span class="op">]</span>, <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fu"><a href="https://rspatial.github.io/terra/reference/dimensions.html">nrow</a></span><span class="op">(</span><span class="va">nz</span><span class="op">)</span><span class="op">)</span><span class="op">)</span>, <span class="va">sum</span><span class="op">)</span></span>
@@ -154,7 +154,7 @@ <h2>
154154
The same applies for all packages showcased in this book, although it can be helpful (when not distracting) to be aware of alternatives and being able to justify your choice of software.</p>
155155
<p>A common choice, for which there is no simple answer, is between <strong>tidyverse</strong> and base R for geocomputation.
156156
The following code chunk, for example, shows <strong>tidyverse</strong> and base R ways to extract the <code>Name</code> column from the <code>nz</code> object, as described in Chapter <a href="attr.html#attr">3</a>:</p>
157-
<div class="sourceCode" id="cb512"><pre class="downlit sourceCode r">
157+
<div class="sourceCode" id="cb513"><pre class="downlit sourceCode r">
158158
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span> <span class="co"># attach a tidyverse package</span></span>
159159
<span><span class="va">nz_name1</span> <span class="op">=</span> <span class="va">nz</span><span class="op">[</span><span class="st">"Name"</span><span class="op">]</span> <span class="co"># base R approach</span></span>
160160
<span><span class="va">nz_name2</span> <span class="op">=</span> <span class="va">nz</span> <span class="op">|&gt;</span> <span class="co"># tidyverse approach</span></span>
@@ -280,13 +280,13 @@ <h3>
280280
You could simply ask how to do this in one of the places outlined in the previous section.
281281
However, it is likely that you will get a better response if you provide a reproducible example of what you have tried so far.
282282
The following code creates a map of the world with blue sea and green land, but the land is not filled in:</p>
283-
<div class="sourceCode" id="cb513"><pre class="downlit sourceCode r">
283+
<div class="sourceCode" id="cb514"><pre class="downlit sourceCode r">
284284
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://r-spatial.github.io/sf/">sf</a></span><span class="op">)</span></span>
285285
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://jakubnowosad.com/spData/">spData</a></span><span class="op">)</span></span>
286286
<span><span class="fu"><a href="https://rspatial.github.io/terra/reference/plot.html">plot</a></span><span class="op">(</span><span class="fu"><a href="https://r-spatial.github.io/sf/reference/st_geometry.html">st_geometry</a></span><span class="op">(</span><span class="va">world</span><span class="op">)</span>, col <span class="op">=</span> <span class="st">"green"</span><span class="op">)</span></span></code></pre></div>
287287
<p>If you post this code in a forum, it is likely that you will get a more specific and useful response.
288288
For example, someone might respond with the following code, which demonstrably solves the problem, as illustrated in Figure <a href="conclusion.html#fig:16-synthesis-reprex">16.1</a>:</p>
289-
<div class="sourceCode" id="cb514"><pre class="downlit sourceCode r">
289+
<div class="sourceCode" id="cb515"><pre class="downlit sourceCode r">
290290
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://r-spatial.github.io/sf/">sf</a></span><span class="op">)</span></span>
291291
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://jakubnowosad.com/spData/">spData</a></span><span class="op">)</span></span>
292292
<span><span class="co"># use the bg argument to fill in the land</span></span>

0 commit comments

Comments
 (0)