Skip to content

Commit

Permalink
Deploy commit: Update routing profile, close #1147 b848389
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Jan 1, 2025
1 parent 0b99176 commit 2dbaac5
Show file tree
Hide file tree
Showing 33 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion 01-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This may sound simple and easy to achieve (which it is if you carefully maintain

We define geocomputation as

> A field of research, software development and practical application that uses geographic data to solve problems, with a focus on reproducibility, flexibility and tool development.
> Academic research, software development and practical applications that use geographic data to solve problems, with a focus on reproducibility, flexibility and tool development.
Geocomputation\index{geocomputation!definition} is a young term, dating back to the first conference on the subject in 1996.^[
The first 'GeoComputation' conference took place at the University of Leeds, where one of the authors (Robin) is currently based.
Expand Down
4 changes: 2 additions & 2 deletions 13-transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ This is done using the publicly available OSRM service with the **stplanr** func

``` r
routes_short = route(l = desire_lines_short, route_fun = route_osrm,
osrm.profile = "bike")
osrm.profile = "car")
```

The output is `routes_short`, an `sf` object representing routes on the transport network\index{network} that are suitable for cycling (according to the OSRM routing engine at least), one for each desire line.
Expand Down Expand Up @@ -570,7 +570,7 @@ routes_short_scenario = routes_short |>
mutate(bicycle = bicycle + car_driver * uptake,
car_driver = car_driver * (1 - uptake))
sum(routes_short_scenario$bicycle) - sum(routes_short$bicycle)
#> [1] 3862
#> [1] 3264
```

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.
Expand Down
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
2 changes: 1 addition & 1 deletion adv-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
2 changes: 1 addition & 1 deletion algorithms.html
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
2 changes: 1 addition & 1 deletion attr.html
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
2 changes: 1 addition & 1 deletion conclusion.html
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
2 changes: 1 addition & 1 deletion eco.html
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
Binary file modified figures/circle-intersection-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/cycleways-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/points-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/rnetvis-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/rnetvis-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/routes-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/wayssln-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion foreword-1st-edition.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
2 changes: 1 addition & 1 deletion foreword-2nd-edition.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
2 changes: 1 addition & 1 deletion geometry-operations.html
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
20 changes: 10 additions & 10 deletions gis.html
Original file line number Diff line number Diff line change
Expand Up @@ -618,21 +618,21 @@ <h2>
<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://rsbivand.github.io/rgrass/">rgrass</a></span><span class="op">)</span></span>
<span><span class="fu">link2GI</span><span class="fu">::</span><span class="fu"><a href="https://r-spatial.github.io/link2GI/reference/linkGRASS.html">linkGRASS</a></span><span class="op">(</span><span class="va">london_streets</span>, ver_select <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
<p>Before we can use GRASS GIS geoalgorithms, we also need to add data to GRASS GIS’s spatial database.
Luckily, the convenience function <code><a href="https://rsbivand.github.io/rgrass/reference/readVECT.html">write_VECT()</a></code> does this for us.
(Use <code><a href="https://rsbivand.github.io/rgrass/reference/readRAST.html">write_RAST()</a></code> for raster data.)
Luckily, the convenience function <code><a href="https://rdrr.io/pkg/rgrass/man/readVECT.html">write_VECT()</a></code> does this for us.
(Use <code><a href="https://rdrr.io/pkg/rgrass/man/readRAST.html">write_RAST()</a></code> for raster data.)
In our case, we add the street and cycle hire point data while using only the first attribute column, and name them as <code>london_streets</code> and <code>points</code> in GRASS GIS.</p>
<div class="sourceCode" id="cb378"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rsbivand.github.io/rgrass/reference/readVECT.html">write_VECT</a></span><span class="op">(</span><span class="fu">terra</span><span class="fu">::</span><span class="fu"><a href="https://rspatial.github.io/terra/reference/vect.html">vect</a></span><span class="op">(</span><span class="va">london_streets</span><span class="op">)</span>, vname <span class="op">=</span> <span class="st">"london_streets"</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rsbivand.github.io/rgrass/reference/readVECT.html">write_VECT</a></span><span class="op">(</span><span class="fu">terra</span><span class="fu">::</span><span class="fu"><a href="https://rspatial.github.io/terra/reference/vect.html">vect</a></span><span class="op">(</span><span class="va">points</span><span class="op">[</span>, <span class="fl">1</span><span class="op">]</span><span class="op">)</span>, vname <span class="op">=</span> <span class="st">"points"</span><span class="op">)</span></span></code></pre></div>
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/pkg/rgrass/man/readVECT.html">write_VECT</a></span><span class="op">(</span><span class="fu">terra</span><span class="fu">::</span><span class="fu"><a href="https://rspatial.github.io/terra/reference/vect.html">vect</a></span><span class="op">(</span><span class="va">london_streets</span><span class="op">)</span>, vname <span class="op">=</span> <span class="st">"london_streets"</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/pkg/rgrass/man/readVECT.html">write_VECT</a></span><span class="op">(</span><span class="fu">terra</span><span class="fu">::</span><span class="fu"><a href="https://rspatial.github.io/terra/reference/vect.html">vect</a></span><span class="op">(</span><span class="va">points</span><span class="op">[</span>, <span class="fl">1</span><span class="op">]</span><span class="op">)</span>, vname <span class="op">=</span> <span class="st">"points"</span><span class="op">)</span></span></code></pre></div>
<p>The <strong>rgrass</strong> package expects its inputs and gives its outputs as <strong>terra</strong> objects.
Therefore, we need to convert our <code>sf</code> spatial vectors to <strong>terra</strong>’s <code>SpatVector</code>s using the <code><a href="https://rspatial.github.io/terra/reference/vect.html">vect()</a></code> function to be able to use <code><a href="https://rsbivand.github.io/rgrass/reference/readVECT.html">write_VECT()</a></code>.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content='&lt;p&gt;You can learn more how to convert between spatial classes in R by reading the (Conversions between different spatial classes in R)[&lt;a href="https://geocompx.org/post/2021/spatial-classes-conversion/" class="uri"&gt;https://geocompx.org/post/2021/spatial-classes-conversion/&lt;/a&gt;] blog post and the
Therefore, we need to convert our <code>sf</code> spatial vectors to <strong>terra</strong>’s <code>SpatVector</code>s using the <code><a href="https://rspatial.github.io/terra/reference/vect.html">vect()</a></code> function to be able to use <code><a href="https://rdrr.io/pkg/rgrass/man/readVECT.html">write_VECT()</a></code>.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content='&lt;p&gt;You can learn more how to convert between spatial classes in R by reading the (Conversions between different spatial classes in R)[&lt;a href="https://geocompx.org/post/2021/spatial-classes-conversion/" class="uri"&gt;https://geocompx.org/post/2021/spatial-classes-conversion/&lt;/a&gt;] blog post and the
(Coercion between object formats)[&lt;a href="https://CRAN.R-project.org/package=rgrass/vignettes/coerce.html" class="uri"&gt;https://CRAN.R-project.org/package=rgrass/vignettes/coerce.html&lt;/a&gt;] vignette.&lt;/p&gt;'><sup>70</sup></a></p>
<p>Now, both datasets exist in the GRASS GIS database.
To perform our network analysis, we need a topologically clean street network.
GRASS GIS’s <code>"v.clean"</code> takes care of the removal of duplicates, small angles and dangles, among others.
Here, we break lines at each intersection to ensure that the subsequent routing algorithm can actually turn right or left at an intersection, and save the output in a GRASS GIS object named <code>streets_clean</code>.</p>
<div class="sourceCode" id="cb379"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rsbivand.github.io/rgrass/reference/execGRASS.html">execGRASS</a></span><span class="op">(</span></span>
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/pkg/rgrass/man/execGRASS.html">execGRASS</a></span><span class="op">(</span></span>
<span> cmd <span class="op">=</span> <span class="st">"v.clean"</span>, input <span class="op">=</span> <span class="st">"london_streets"</span>, output <span class="op">=</span> <span class="st">"streets_clean"</span>,</span>
<span> tool <span class="op">=</span> <span class="st">"break"</span>, flags <span class="op">=</span> <span class="st">"overwrite"</span></span>
<span><span class="op">)</span></span></code></pre></div>
Expand All @@ -646,7 +646,7 @@ <h2>
<code>"v.net"</code>’s connect-operator does exactly this.
We save its output in <code>streets_points_con</code>.</p>
<div class="sourceCode" id="cb380"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rsbivand.github.io/rgrass/reference/execGRASS.html">execGRASS</a></span><span class="op">(</span></span>
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/pkg/rgrass/man/execGRASS.html">execGRASS</a></span><span class="op">(</span></span>
<span> cmd <span class="op">=</span> <span class="st">"v.net"</span>, input <span class="op">=</span> <span class="st">"streets_clean"</span>, output <span class="op">=</span> <span class="st">"streets_points_con"</span>,</span>
<span> points <span class="op">=</span> <span class="st">"points"</span>, operation <span class="op">=</span> <span class="st">"connect"</span>, threshold <span class="op">=</span> <span class="fl">0.001</span>,</span>
<span> flags <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"overwrite"</span>, <span class="st">"c"</span><span class="op">)</span></span>
Expand All @@ -657,14 +657,14 @@ <h2>
Since we would like to calculate the route for all cycle stations, we set it to <code>1-25</code>.
To access the GRASS GIS help page of the traveling salesman algorithm, run <code>execGRASS("g.manual", entry = "v.net.salesman")</code>.</p>
<div class="sourceCode" id="cb381"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rsbivand.github.io/rgrass/reference/execGRASS.html">execGRASS</a></span><span class="op">(</span></span>
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/pkg/rgrass/man/execGRASS.html">execGRASS</a></span><span class="op">(</span></span>
<span> cmd <span class="op">=</span> <span class="st">"v.net.salesman"</span>, input <span class="op">=</span> <span class="st">"streets_points_con"</span>,</span>
<span> output <span class="op">=</span> <span class="st">"shortest_route"</span>, center_cats <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span><span class="op">(</span><span class="st">"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">points</span><span class="op">)</span><span class="op">)</span>,</span>
<span> flags <span class="op">=</span> <span class="st">"overwrite"</span></span>
<span><span class="op">)</span></span></code></pre></div>
<p>To see our result, we read the result into R, convert it into an <code>sf</code>-object keeping only the geometry, and visualize it with the help of the <strong>mapview</strong> package (Figure <a href="gis.html#fig:grass-mapview">10.5</a> and Section <a href="adv-map.html#interactive-maps">9.4</a>).</p>
<div class="sourceCode" id="cb382"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">route</span> <span class="op">=</span> <span class="fu"><a href="https://rsbivand.github.io/rgrass/reference/readVECT.html">read_VECT</a></span><span class="op">(</span><span class="st">"shortest_route"</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<code class="sourceCode R"><span><span class="va">route</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/pkg/rgrass/man/readVECT.html">read_VECT</a></span><span class="op">(</span><span class="st">"shortest_route"</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<span> <span class="fu"><a href="https://r-spatial.github.io/sf/reference/st_as_sf.html">st_as_sf</a></span><span class="op">(</span><span class="op">)</span> <span class="op">|&gt;</span></span>
<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="op">)</span></span>
<span><span class="fu">mapview</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/mapview/man/mapView.html">mapview</a></span><span class="op">(</span><span class="va">route</span><span class="op">)</span> <span class="op">+</span> <span class="va">points</span></span></code></pre></div>
Expand Down Expand Up @@ -1064,7 +1064,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h1>Welcome<a class="anchor" aria-label="anchor" href="#welcome"><i class="fas f
<p>The online version of the book is hosted at <a href="https://r.geocompx.org">r.geocompx.org</a> and kept up-to-date by <a href="https://github.com/geocompx/geocompr/actions">GitHub Actions</a>.
Its current ‘build status’ as follows:</p>
<p><a href="https://github.com/geocompx/geocompr/actions"><img src="https://github.com/geocompx/geocompr/workflows/Render/badge.svg" alt="Actions"></a></p>
<p>This version of the book was built on GH Actions on 2024-12-26.</p>
<p>This version of the book was built on GH Actions on 2025-01-01.</p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png"></a><br>This book is licensed to you under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>.</p>
<p><a rel="license" href="https://creativecommons.org/publicdomain/zero/1.0/"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/zero/1.0/88x31.png"></a><br>The code samples in this book are licensed under <a rel="license" href="https://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC0 1.0 Universal (CC0 1.0)</a>.</p>
<div id="how-to-contribute" class="section level2 unnumbered">
Expand Down Expand Up @@ -237,7 +237,7 @@ <h2>Second Edition</h2>
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

<div class="col-12 col-md-6 mt-3">
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2024-12-26.</p>
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2025-01-01.</p>
</div>

<div class="col-12 col-md-6 mt-3">
Expand Down
Loading

0 comments on commit 2dbaac5

Please sign in to comment.