Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete proofing updates to foreword #1116

Merged
merged 10 commits into from
Sep 24, 2024
10 changes: 5 additions & 5 deletions 01-introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ After reading the book and completing the exercises you should be ready to tackl
Over the last few decades free and open source software for geospatial (FOSS4G\index{FOSS4G}) has progressed at an astonishing rate.
Thanks to organizations such as OSGeo, advanced geographic techniques are no longer the preserve of those with expensive hardware and software: anyone can now download and run high-performance software for geocomputation.
Open source Geographic Information Systems (GIS\index{GIS}), such as [QGIS](https://qgis.org/en/site/)\index{QGIS}, have made geographic analysis accessible worldwide.
GIS software products are powerful, but tend to emphasize a graphical user interface\index{graphical user interface} (GUI) approach over the command-line interface (CLI) approach advocated in this book.
GIS software products are powerful, but tend to emphasize a graphical user interface\index{graphical user interface} (GUI) approach over the command line interface (CLI) approach advocated in this book.
The 'GUI-focus' of many GIS products has unintended consequence of disabling many users from making their work full reproducible\index{reproducibility}, a problem that can be overcome by calling 'geoalgorithms' contained in GIS software from the command line, as we'll see in Chapter \@ref(gis).
A simplistic comparison between the different approaches is illustrated in Table \@ref(tab:gdsl).

Expand All @@ -38,12 +38,12 @@ Other command environments with powerful geographic capabilities exist, includin
However, R has advantages that make it a good language for learning geocomputation and for many geocomputation tasks, especially for statistics, modelling and visualization, as outlined in Section \@ref(why-open-source).

This book is also motivated by the importance of reproducibility\index{reproducibility} for scientific research.
It aims to make reproducible geographic data analysis\index{geographic data analysis} workflows more accessible, and demonstrate the power of open geospatial software available from the command-line.
It aims to make reproducible geographic data analysis\index{geographic data analysis} workflows more accessible, and demonstrate the power of open geospatial software available from the command line.
R provides ways to interface with other languages [@eddelbuettel_extending_2018], enabling numerous spatial software libraries to be called from R, as explained in Section \@ref(why-use-r-for-geocomputation) and demonstrated in Chapter \@ref(gis).
Before going into the details of the software, however, it is worth taking a step back and thinking about what we mean by geocomputation\index{geocomputation}.

```{block2 01-introduction-1, type='rmdnote'}
Reproducibility is a major advantage of command-line interfaces, but what does it mean in practice?
Reproducibility is a major advantage of command line interfaces, but what does it mean in practice?
We define it as follows: "A process in which the same results can be generated by others using publicly accessible code."

This may sound simple and easy to achieve (which it is if you carefully maintain your R code in script files), but has profound implications for teaching and the scientific process [@pebesma_r_2012].
Expand Down Expand Up @@ -94,7 +94,7 @@ This book aims to contribute to the still-evolving 'Geographic Tradition' [@livi
The book's links to older disciplines were reflected in suggested titles for the book: *Geography with R* and *R for GIS*.
Each has advantages.
The former conveying the applied nature of the content, about more than where something is on the map.
The latter communicates that this is a book about using R as powerful command-line geographic information system, to perform spatial operations on *geographic data*.
The latter communicates that this is a book about using R as powerful command line geographic information system, to perform spatial operations on *geographic data*.
However, the term GIS has connotations which fail to communicate some of R's\index{R} greatest strengths:
its abilities to seamlessly switch between geographic and non-geographic data processing, modeling and visualization tasks while enabling reproducibility go far beyond the capabilities of GIS.
Geocomputation\index{geocomputation} implies working with geographic data in a reproducible code-driven environment and programming new results, methods and tools, which is what this book is all about.\index{GIS!connotations}
Expand Down Expand Up @@ -233,7 +233,7 @@ Equally important, R has unparalleled support for statistics\index{statistics},
The major advantage of Python is that it is a *general-purpose* programming language.
It is used in many domains, including desktop software, computer games, websites and data science\index{data science}.
Python\index{Python} is often the only shared language between different (geocomputation) communities and can be seen as the 'glue' that holds many GIS\index{GIS} programs together.
Many geoalgorithms\index{geoalgorithm}, including those in QGIS\index{QGIS} and ArcMap, can be accessed from the Python command line, making it well-suited as a starter language for command-line GIS.^[
Many geoalgorithms\index{geoalgorithm}, including those in QGIS\index{QGIS} and ArcMap, can be accessed from the Python command line, making it well suited as a starter language for command line GIS.^[
Python modules providing access to geoalgorithms\index{geoalgorithm} include `grass.script` for GRASS GIS\index{GRASS GIS},
`saga-python` for SAGA-GIS\index{SAGA},
`processing` for QGIS\index{QGIS} and `arcpy` for ArcGIS\index{ArcGIS}.
Expand Down
2 changes: 1 addition & 1 deletion 02-spatial-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ source("https://github.com/geocompx/geocompr/raw/main/code/02-vectorplots.R") #
knitr::include_graphics(c("images/vector_lonlat.png", "images/vector_projected.png"))
```

The **sf** package provides classes for geographic vector data and a consistent command-line interface to important low level libraries for geocomputation:
The **sf** package provides classes for geographic vector data and a consistent command line interface to important low level libraries for geocomputation:

- [GDAL](https://gdal.org/)\index{GDAL}, for reading, writing and manipulating a wide range of geographic data formats, covered in Chapter \@ref(read-write)
- [PROJ](https://proj.org/), a powerful library for coordinate system transformations, which underlies the content covered in Chapter \@ref(reproj-geo-data)
Expand Down
12 changes: 6 additions & 6 deletions 10-gis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ rather than relying on pointing and clicking on different parts of a screen, you
A common and effective workflow when using interactive development environments such as RStudio or VS Code is to type code into source files in a source editor and control interactive execution of the code with a shortcut such as `Ctrl+Enter`.

CLIs are not unique to R: most early computing environments relied on a command line 'shell' and it was only after the invention and widespread adoption of the computer mouse in the 1990s that graphical user interfaces (GUIs)\index{graphical user interface} became common.
GRASS GIS the longest-standing continuously-developed open source GIS\index{GIS} software, for example, relied on its command-line interface before it gained a GUI [@landa_new_2008].
GRASS GIS the longest-standing continuously-developed open source GIS\index{GIS} software, for example, relied on its command line interface before it gained a GUI [@landa_new_2008].
Most popular GIS software projects are GUI-driven.
You *can* interact with QGIS\index{QGIS}, SAGA\index{SAGA}, GRASS GIS\index{GRASS GIS} and gvSIG from system terminals and embedded CLIs, but their design encourages most people to interact with them by 'pointing and clicking'.
An unintended consequence of this is that most GIS users miss out on the advantages of CLI-driven and scriptable approaches.
According to the creator of the popular QGIS software [@sherman_desktop_2008]:

> With the advent of 'modern' GIS software, most people want to point and click their way through life. That’s good, but there is a tremendous amount of flexibility and power waiting for you with the command line. Many times you can do something on the command line in a fraction of the time you can do it with a GUI.

The 'CLI vs GUI' debate does not have to be adverserial: both ways of working have advantages, depending on a range of factors including the task (with drawing new features being well-suited to GUIs), the level of reproducibility desired, and the user's skillset.
The 'CLI vs GUI' debate does not have to be adverserial: both ways of working have advantages, depending on a range of factors including the task (with drawing new features being well suited to GUIs), the level of reproducibility desired, and the user's skillset.
GRASS GIS is a good example of GIS software that is primarily based on a CLI but which also has a prominent GUI.
Likewise, while R is focused on its CLI, IDEs such as RStudio provide a GUI for improving accessibility.
Software cannot be neatly categorised into CLI-based or GUI-based.
Expand All @@ -73,7 +73,7 @@ Another advantage of dedicated GIS software projects is that they provide access
Such bridges to these computational recipes for enhancing R's capabilities for solving geographic data problems are the topic of this chapter.

```{block2 09-gis-2, type="rmdnote"}
A command-line interface is an environment for interacting with computer programs by typing and entering successive commands (command lines).
A command line interface is an environment for interacting with computer programs by typing and entering successive commands (command lines).
`bash` in Linux and `PowerShell` in Windows are well-known examples that allow the user to control almost any part of their operating system.
IDEs such as RStudio and VS Code provide code auto-completion and other features to improve the user experience when developing code.
```
Expand All @@ -82,7 +82,7 @@ R is a natural choice for people wanting to build bridges between reproducible d
A key feature of R (and its predecessor S) is that it provides access to statistical algorithms in other languages (particularly FORTRAN\index{FORTRAN} and C), but from a powerful high level functional language with an intuitive REPL environment, which C and FORTRAN lacked [@chambers_extending_2016].
R continues this tradition with interfaces to numerous languages, notably C++\index{C++}.

Although R was not designed as a command-line GIS, its ability to interface with dedicated GISs gives it astonishing geospatial capabilities.
Although R was not designed as a command line GIS, its ability to interface with dedicated GISs gives it astonishing geospatial capabilities.
With GIS bridges, R can replicate more diverse workflows, with the additional reproducibility, scalability and productity benefits of controlling them from a programming environment and a consistent CLI.
Furthermore, R outperforms GISs in some areas of geocomputation\index{geocomputation}, including interactive/animated map making (see Chapter \@ref(adv-map)) and spatial statistical modeling (see Chapter \@ref(spatial-cv)).

Expand Down Expand Up @@ -481,7 +481,7 @@ knitr::include_graphics("images/10-qgis-raster-map.png")

## SAGA {#saga}

The System for Automated Geoscientific Analyses (SAGA\index{SAGA}; Table \@ref(tab:gis-comp)) provides the possibility to execute SAGA modules via the command line interface\index{command-line interface} (`saga_cmd.exe` under Windows and just `saga_cmd` under Linux) (see the [SAGA wiki on modules](https://sourceforge.net/p/saga-gis/wiki/Executing%20Modules%20with%20SAGA%20CMD/)).
The System for Automated Geoscientific Analyses (SAGA\index{SAGA}; Table \@ref(tab:gis-comp)) provides the possibility to execute SAGA modules via the command line interface\index{command line interface} (`saga_cmd.exe` under Windows and just `saga_cmd` under Linux) (see the [SAGA wiki on modules](https://sourceforge.net/p/saga-gis/wiki/Executing%20Modules%20with%20SAGA%20CMD/)).
In addition, there is a Python interface (SAGA Python API\index{API}).
**Rsagacmd**\index{Rsagacmd (package)} uses the former to run SAGA\index{SAGA} from within R.

Expand Down Expand Up @@ -939,7 +939,7 @@ tm_shape(buf) +
```

Unlike PostGIS, **sf** only supports spatial vector data.
To query and manipulate raster data stored in a PostGIS database, use the **rpostgis** package [@bucklin_rpostgis_2018] and/or use command-line tools such as `rastertopgsql` which comes as part of the PostGIS\index{PostGIS} installation.
To query and manipulate raster data stored in a PostGIS database, use the **rpostgis** package [@bucklin_rpostgis_2018] and/or use command line tools such as `rastertopgsql` which comes as part of the PostGIS\index{PostGIS} installation.

This subsection is only a brief introduction to PostgreSQL/PostGIS.
Nevertheless, we would like to encourage the practice of storing geographic and non-geographic data in a spatial DBMS\index{spatial database} while only attaching those subsets to R's global environment which are needed for further (geo-)statistical analysis.
Expand Down
2 changes: 1 addition & 1 deletion 13-transport.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ Options include [**sfnetworks**](https://luukvdmeer.github.io/sfnetworks/)\index

While fast and flexible, native R routing options are generally harder to set-up than dedicated routing engines for realistic route calculation.
Routing is a hard problem and many hundreds of hours have been put into open source routing engines that can be downloaded and hosted locally.
On the other hand, R-based routing engines may be well-suited to model experiments and the statistical analysis of the impacts of changes on the network.
On the other hand, R-based routing engines may be well suited to model experiments and the statistical analysis of the impacts of changes on the network.
Changing route network characteristics (or weights associated with different route segment types), re-calculating routes, and analyzing results under many scenarios in a single language has benefits for research applications.

### Locally hosted dedicated routing engines {#localengine}
Expand Down
6 changes: 3 additions & 3 deletions 16-synthesis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ See [*Geocomputation with Python*](https://py.geocompx.org/), for an introductio
Dozens of geospatial libraries have been developed in C++\index{C++}, including well known libraries such as GDAL\index{GDAL} and GEOS\index{GEOS}, and less well known libraries such as the **[Orfeo Toolbox](https://github.com/orfeotoolbox/OTB)** for processing remote sensing (raster) data.
[**Turf.js**](https://github.com/Turfjs/turf) is an example of the potential for doing geocomputation with JavaScript.
[GeoTrellis](https://geotrellis.io/) provides functions for working with raster and vector data in the Java-based language Scala.
And [WhiteBoxTools](https://github.com/jblindsay/whitebox-tools) provides an example of a rapidly evolving command-line GIS implemented in Rust.
And [WhiteBoxTools](https://github.com/jblindsay/whitebox-tools) provides an example of a rapidly evolving command line GIS implemented in Rust.
\index{Rust}
\index{WhiteboxTools}
Each of these packages/libraries/languages has advantages for geocomputation and there are many more to discover, as documented in the curated list of open source geospatial resources [Awesome-Geospatial](https://github.com/sacridini/Awesome-Geospatial).
Expand Down Expand Up @@ -298,10 +298,10 @@ Reproducibility\index{reproducibility}:
- Discourages people from 'reinventing the wheel': there is no need to re-do what others have done if their methods can be used by others
- Makes research more conducive to real world applications, by enabling anyone in any sector to apply your methods in new areas

If reproducibility is the defining asset of geocomputation (or command-line GIS) it is worth considering what makes it reproducible.
If reproducibility is the defining asset of geocomputation (or command line GIS) it is worth considering what makes it reproducible.
This brings us to the 'open source approach', which has three main components:

- A command-line interface\index{command-line interface} (CLI), encouraging scripts recording geographic work to be shared and reproduced
- A command line interface\index{command line interface} (CLI), encouraging scripts recording geographic work to be shared and reproduced
- Open source software, which can be inspected and potentially improved by anyone in the world
- An active user and developer community, which collaborates and self-organizes to build complementary and modular tools

Expand Down
2 changes: 1 addition & 1 deletion code/chapters/01-introduction.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ knitr::kable(x = d,
booktabs = TRUE)


## Reproducibility is a major advantage of command-line interfaces, but what does it mean in practice?
## Reproducibility is a major advantage of command line interfaces, but what does it mean in practice?

## We define it as follows: "A process in which the same results can be generated by others using publicly accessible code."

Expand Down
2 changes: 1 addition & 1 deletion code/chapters/10-gis.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ library(terra)
## library(gdalcubes)


## A command-line interface is a means of interacting with computer programs in which the user issues commands via successive lines of text (command lines).
## A command line interface is a means of interacting with computer programs in which the user issues commands via successive lines of text (command lines).

## `bash` in Linux and `PowerShell` in Windows are its common examples.

Expand Down
Loading
Loading