Skip to content

Commit 3001cdc

Browse files
committed
Deploy commit: 1115 proofreading changes 3 (#1129)
* Be more specific and accurate: raster and vector datasets *used* in many fields * as it -> , as it * 3-d -> three-d* * -0.1 -> $-0.1$ * (the Prime M...) -> (Prime M...) * peninsular -> peninsula * low level libraries -> low-level libraries * Fix-up wording about importance of GDAL and friends * Tweaks * 2-d -> two-d * Add missing comma * in Sec -> Sec * Remove hyperlink from the * Time of writing, * Update at the time of writing * re-iterate -> reiterate * CRSs abbreviation * A spatial -> Spatial * Shorten description of sticky * CRSs * this reason -> this reason, * Neither has * Fix grammar, mention border arg of plot() * Basic maps * A plot -> Plot * Base plot limits * Shift index entries * 7 -> seven * two-, three-, or four-dimensional space * From scratch, * Tweaks to 2.2.5 * Update hyperlink * Examples, the * Assorted typo fixes * Assorted changes * multilayered -> multi-layered and more * the Zion -> Zion * Mention fig:basic-new-raster-plot in the text * multilayer -> multi-layer * Tweaks to 2.4 * Spell-out UTM, finish c2 * Avoid superscript * , but * Italics * Boolean * 3 -> three * Continent * Complete fixes for c3 * Start on c4 * Fixes for c4 * Update 02-spatial-data.Rmd Co-authored-by: Jakub Nowosad <Nowosad@users.noreply.github.com> * Assorted changes * Assorted changes to c4 * Tweak NDVI bit * Clarify na.rm argument in c4 * Fixes for c4 --------- Co-authored-by: Jakub Nowosad <Nowosad@users.noreply.github.com> f72e44e
1 parent a473444 commit 3001cdc

38 files changed

Lines changed: 487 additions & 484 deletions

01-introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ There are many ways to handle geographic data in R, with dozens of packages\inde
228228
An overview of R's spatial ecosystem can be found in the CRAN\index{CRAN} Task View on the Analysis of Spatial Data
229229
(see https://cran.r-project.org/view=Spatial).
230230
]
231-
In this book we endeavor to teach the state-of-the-art in the field whilst ensuring that the methods are future-proof.
231+
In this book, we endeavor to teach the state-of-the-art in the field whilst ensuring that the methods are future-proof.
232232
Like many areas of software development, R's spatial ecosystem is rapidly evolving (Figure \@ref(fig:cranlogs)).
233233
Because R is open source, these developments can easily build on previous work, by 'standing on the shoulders of giants', as Isaac Newton put it in [1675](https://digitallibrary.hsp.org/index.php/Detail/objects/9792).
234234
This approach is advantageous because it encourages collaboration and avoids 'reinventing the wheel'.
@@ -292,7 +292,7 @@ R's spatial capabilities have evolved substantially since then, but they still b
292292
Interfaces to GDAL\index{GDAL} and PROJ\index{PROJ}, for example, still power R's high-performance geographic data I/O and CRS\index{CRS} transformation capabilities, as outlined in Chapters \@ref(reproj-geo-data) and \@ref(read-write), respectively.
293293

294294
**rgdal**, released in 2003, provided GDAL\index{GDAL} bindings for R which greatly enhanced its ability to import data from previously unavailable geographic data formats.
295-
The initial release supported only raster drivers, but subsequent enhancements provided support for coordinate reference systems (via the PROJ library), reprojections and import of vector file formats.
295+
The initial release supported only raster drivers, but subsequent enhancements provided support for CRSs (via the PROJ library), reprojections and import of vector file formats.
296296
Many of these additional capabilities were developed by Barry Rowlingson and released in the **rgdal** codebase in 2006, as described in @rowlingson_rasp:_2003 and the [R-help](https://stat.ethz.ch/pipermail/r-help/2003-January/028413.html) email list.
297297

298298
The **sp** package, released in 2005, was a significant advancement in R's spatial capabilities.
@@ -341,7 +341,7 @@ Additional ways of representing and working with geographic data in R since 2018
341341
\index{lidR (package)}
342342

343343
Such developments have been motivated by the emergence of new technologies, standards and software outside of the R environment [@bivand_progress_2021].
344-
Major updates to the PROJ library\index{PROJ} beginning in 2018 forced the replacement of 'proj-string' representations of coordinate reference systems with 'Well Known Text', as described in Section \@ref(crs-intro) and Chapter \@ref(reproj-geo-data).
344+
Major updates to the PROJ library\index{PROJ} beginning in 2018 forced the replacement of 'proj-string' representations of CRSs with 'Well Known Text', as described in Section \@ref(crs-intro) and Chapter \@ref(reproj-geo-data).
345345

346346
\index{rayshader (package)}
347347
Since the publication of the first version of Geocomputation with R in 2018, several packages for spatial data visualization have been developed and improved.

02-spatial-data.md

Lines changed: 91 additions & 90 deletions
Large diffs are not rendered by default.

03-attribute-operations.md

Lines changed: 32 additions & 31 deletions
Large diffs are not rendered by default.

04-spatial-operations.md

Lines changed: 62 additions & 61 deletions
Large diffs are not rendered by default.

05-geometry-operations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Importantly it also shows how to 'polygonize' rasters and 'rasterize' vector dat
3939
## Geometric operations on vector data {#geo-vec}
4040

4141
This section is about operations that in some way change the geometry of vector (`sf`) objects.
42-
It is more advanced than the spatial data operations presented in the previous chapter (in Section \@ref(spatial-vec)), because here we drill down into the geometry:
42+
It is more advanced than the spatial data operations presented in the previous chapter (Section \@ref(spatial-vec)), because here we drill down into the geometry:
4343
the functions discussed in this section work on objects of class `sfc` in addition to objects of class `sf`.
4444

4545
### Simplification
@@ -802,7 +802,7 @@ The main resampling methods include:
802802
- Nearest neighbor: assigns the value of the nearest cell of the original raster to the cell of the target one. This is a fast simple technique that is usually suitable for resampling categorical rasters.
803803
- Bilinear interpolation: assigns a weighted average of the four nearest cells from the original raster to the cell of the target one (Figure \@ref(fig:bilinear)). This is the fastest method that is appropriate for continuous rasters.
804804
- Cubic interpolation: uses values of the 16 nearest cells of the original raster to determine the output cell value, applying third-order polynomial functions. Used for continuous rasters and results in a smoother surface compared to bilinear interpolation but is computationally more demanding.
805-
- Cubic spline interpolation: also uses values of the 16 nearest cells of the original raster to determine the output cell value but applies cubic splines (piece-wise third-order polynomial functions). Used for continuous rasters.
805+
- Cubic spline interpolation: also uses values of the 16 nearest cells of the original raster to determine the output cell value, but applies cubic splines (piece-wise third-order polynomial functions). Used for continuous rasters.
806806
- Lanczos windowed sinc resampling: uses values of the 36 nearest cells of the original raster to determine the output cell value. Used for continuous rasters.^[
807807
More detailed explanation of this method can be found at https://gis.stackexchange.com/a/14361/20955.
808808
]

06-raster-vector.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ srtm_cropped = crop(srtm, zion)
5757

5858
\index{raster!masking}
5959
Related to `crop()` is the **terra** function `mask()`, which sets values outside of the bounds of the object passed to its second argument to `NA`.
60-
The following command therefore masks every cell outside of the Zion National Park boundaries (Figure \@ref(fig:cropmask)(C)).
60+
The following command therefore masks every cell outside of Zion National Park boundaries (Figure \@ref(fig:cropmask)(C)).
6161

6262

6363
``` r
@@ -95,7 +95,7 @@ The reverse of raster extraction --- assigning raster cell values based on vecto
9595

9696
\index{raster!extraction points}
9797
The basic example is of extracting the value of a raster cell at specific **points**.
98-
For this purpose, we will use `zion_points`, which contain a sample of 30 locations within the Zion National Park (Figure \@ref(fig:pointextr)).
98+
For this purpose, we will use `zion_points`, which contain a sample of 30 locations within Zion National Park (Figure \@ref(fig:pointextr)).
9999
The following command extracts elevation values from `srtm` and creates a data frame with points' IDs (one value per vector's row) and related `srtm` values for each point.
100100
Now, we can add the resulting object to our `zion_points` dataset with the `cbind()` function:
101101

07-reproj.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ It demonstrates how to set and *transform* geographic data from one CRS to anoth
2424
\index{CRS!projected}
2525

2626
In many projects there is no need to worry about, let alone convert between, different CRSs.
27-
Nonetheless, it is important to know if your data is in a projected or geographic coordinate reference system, and the consequences of this for geometry operations.
27+
Nonetheless, it is important to know if your data is in a projected or geographic CRS, and the consequences of this for geometry operations.
2828
If you know this information, CRSs should *just work* behind the scenes: people often suddenly need to learn about CRSs when things go wrong.
2929
Having a clearly defined CRS that all project data is in, and understanding how and why to use different CRSs, can ensure that things don't go wrong.
3030
Furthermore, learning about coordinate systems will deepen your knowledge of geographic datasets and how to use them effectively.
@@ -500,7 +500,7 @@ london2 = st_transform(london_geo, "EPSG:27700")
500500

501501
Now that a transformed version of `london` has been created, using the **sf** function `st_transform()`, the distance between the two representations of London can be found.^[
502502
An alternative to `st_transform()` is `st_transform_proj()` from the **lwgeom**, which enables transformations and which bypasses GDAL and can support projections not supported by GDAL.
503-
However, at the time of writing (2022) we could not find any projections supported by `st_transform_proj()` but not supported by `st_transform()`.
503+
However, at the time of writing (2024) we could not find any projections supported by `st_transform_proj()` but not supported by `st_transform()`.
504504
]
505505
It may come as a surprise that `london` and `london2` are over 2 km apart!^[
506506
The difference in location between the two points is not due to imperfections in the transforming operation (which is in fact very accurate) but the low precision of the manually-created coordinates that created `london` and `london_proj`.

08-read-write-plot.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ It is fast and flexible, but it may be worth looking at other packages such as *
386386
### Raster data {#raster-data-read}
387387

388388
\index{raster!data input}
389-
Similar to vector data, raster data comes in many file formats with some supporting multilayer files.
389+
Similar to vector data, raster data comes in many file formats with some supporting multi-layerfiles.
390390
**terra**'s `rast()` command reads in a single layer when a file with just one layer is provided.
391391

392392

@@ -395,7 +395,7 @@ raster_filepath = system.file("raster/srtm.tif", package = "spDataLarge")
395395
single_layer = rast(raster_filepath)
396396
```
397397

398-
It also works in case you want to read a multilayer file.
398+
It also works in case you want to read a multi-layerfile.
399399

400400

401401
``` r
@@ -680,7 +680,7 @@ usa_sf = ne_countries(country = "United States of America", returnclass = "sf")
680680
Country borders can be also accessed with other packages, such as **geodata**, **giscoR**, or **rgeoboundaries**.
681681

682682
A second example downloads a series of rasters containing global monthly precipitation sums with spatial resolution of 10 minutes (~18.5 km at the equator) using the **geodata** package [@R-geodata].
683-
The result is a multilayer object of class `SpatRaster`.
683+
The result is a multi-layerobject of class `SpatRaster`.
684684

685685

686686
``` r
@@ -799,7 +799,7 @@ Map image representations, such as tiles, can be accessed with the Web Map Servi
799799
Metadata is also covered by means of the Catalogue Service for the Web (CSW)\index{geographic web services!CSW}.
800800
Finally, standard processing is handled through the Web Processing Service (WPS)\index{geographic web services!WPS} or the the Web Coverage Processing Service (WCPS)\index{geographic web services!WCPS}.
801801

802-
Various open-source projects have adopted these protocols, such as [GeoServer](https://geoserver.org/) and [MapServer](https://mapserver.org/) for data handling, or [GeoNetwork](https://geonetwork-opensource.org/) and [PyCSW](https://pycsw.org/) for metadata handling, leading to standardization of queries.
802+
Various open-source projects have adopted these protocols, such as [GeoServer](https://geoserver.org/) and [MapServer](https://mapserver.org/) for data-handling, or [GeoNetwork](https://geonetwork-opensource.org/) and [PyCSW](https://pycsw.org/) for metadata-handling, leading to standardization of queries.
803803
Integrated tools for Spatial Data Infrastructures (SDI), such as [GeoNode](https://geonode.org/), [GeOrchestra](https://www.georchestra.org/) or [Examind](https://www.examind.com/) have also adopted these standard webservices, either directly or by using previously mentioned open-source tools.
804804

805805
Like other web APIs, OWS APIs use a 'base URL', an 'endpoint' and 'URL query arguments' following a `?` to request data (see the [`best-practices-api-packages`](https://httr.r-lib.org/articles/api-packages.html) vignette in the **httr** package).

09-mapping.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ tm_shape(nz) + tm_polygons(fill = "Median_income",
307307
```
308308

309309
<div class="figure" style="text-align: center">
310-
<img src="figures/tmpal-1.png" alt="Illustration of color settings. The results show (from left to right): default settings, manual breaks, n breaks, and the impact of changing the palette." width="100%" />
311-
<p class="caption">(\#fig:tmpal)Illustration of color settings. The results show (from left to right): default settings, manual breaks, n breaks, and the impact of changing the palette.</p>
310+
<img src="figures/tmpal-1.png" alt="Color settings. The results show (from left to right): default settings, manual breaks, n breaks, and the impact of changing the palette." width="100%" />
311+
<p class="caption">(\#fig:tmpal)Color settings. The results show (from left to right): default settings, manual breaks, n breaks, and the impact of changing the palette.</p>
312312
</div>
313313

314314
\BeginKnitrBlock{rmdnote}<div class="rmdnote">All of the above arguments (`breaks`, `n`, and `values`) also work for other types of visual variables.

11-algorithms.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Prerequisites {-}
66

7-
This chapter has minimal software prerequisites as it primarily uses base R.
7+
This chapter has minimal software prerequisites, as it primarily uses base R.
88
Only, the **sf**\index{sf} package is used to check the results of an algorithm we will develop to calculate the area of polygons.
99
In terms of prior knowledge, this chapter assumes you have an understanding of the geographic classes introduced in Chapter \@ref(spatial-class) and how they can be used to represent a wide range of input file formats (see Chapter \@ref(read-write)).
1010

@@ -192,8 +192,8 @@ C1 = (T1[1,] + T1[2,] + T1[3,]) / 3
192192

193193

194194
<div class="figure" style="text-align: center">
195-
<img src="figures/polymat-1.png" alt="Illustration of polygon centroid calculation problem." width="100%" />
196-
<p class="caption">(\#fig:polymat)Illustration of polygon centroid calculation problem.</p>
195+
<img src="figures/polymat-1.png" alt="Polygon centroid calculation problem." width="100%" />
196+
<p class="caption">(\#fig:polymat)Polygon centroid calculation problem.</p>
197197
</div>
198198

199199
Step 3 is to find the area of each triangle, so a *weighted mean* accounting for the disproportionate impact of large triangles is accounted for.
@@ -275,7 +275,7 @@ Algorithm\index{algorithm} development is hard.
275275
This should be apparent from the amount of work that has gone into developing a centroid\index{centroid} algorithm\index{algorithm} in base R\index{R} that is just one, rather inefficient, approach to the problem with limited real-world applications (convex polygons are uncommon in practice).
276276
The experience should lead to an appreciation of low-level geographic libraries such as GEOS\index{GEOS} and CGAL\index{CGAL} (the Computational Geometry Algorithms Library) which not only run fast but work on a wide range of input geometry types.
277277
A great advantage of the open source nature of such libraries is that their source code\index{source code} is readily available for study, comprehension and (for those with the skills and confidence) modification.^[
278-
The CGAL\index{CGAL} function `CGAL::centroid()` is in fact composed of 7 sub-functions as described at https://doc.cgal.org/latest/Kernel_23/group__centroid__grp.html allowing it to work on a wide range of input data types, whereas the solution we created works only on a very specific input data type.
278+
The CGAL\index{CGAL} function `CGAL::centroid()` is in fact composed of seven sub-functions as described at https://doc.cgal.org/latest/Kernel_23/group__centroid__grp.html allowing it to work on a wide range of input data types, whereas the solution we created works only on a very specific input data type.
279279
The source code underlying GEOS\index{GEOS} function `Centroid::getCentroid()` can be found at https://github.com/libgeos/geos/search?q=getCentroid.
280280
]
281281

0 commit comments

Comments
 (0)