You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 02-spatial-data.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ If you are new to R, we recommend following introductory R resources such as [Ha
18
18
These resources cover in detail how to install R, which simply involves downloading the latest version from the [Comprehensive R Archive Network (CRAN)](https://cran.r-project.org/).
19
19
See the note below for more information on installing R for geocomputation on Mac and Linux.
20
20
Organize your work into [projects](https://r4ds.had.co.nz/workflow-projects.html) and give scripts sensible names such as `chapter-02.R` (or equivalent RMarkdown or Quarto file names) to document the code as you learn.
21
-
\index{R!pre-requisites}
21
+
\index{R!prerequisites}
22
22
23
23
\index{R!installation}
24
24
\BeginKnitrBlock{rmdnote}<divclass="rmdnote">Mac and Linux operating systems (OSs) have additional systems requirements, which can be found in the README of the [**sf** package](https://github.com/r-spatial/sf).
@@ -74,7 +74,7 @@ We will introduce the theory behind each data model and the disciplines in which
74
74
The *vector data model* represents the world using points, lines and polygons.
75
75
These have discrete, well-defined borders, meaning that vector datasets usually have a high level of precision (but not necessarily accuracy as we will see in Section \@ref(units)).
76
76
The *raster data model* divides the surface up into cells of constant size.
77
-
Raster datasets are the basis of background images used in web-mapping and have been a vital source of geographic data since the origins of aerial photography and satellite-based remote sensing devices.
77
+
Raster datasets are the basis of background images used in webmapping and have been a vital source of geographic data since the origins of aerial photography and satellite-based remote sensing devices.
78
78
Rasters aggregate spatially specific features to a given resolution, meaning that they are consistent over space and scalable (many worldwide raster datasets are available).
Copy file name to clipboardExpand all lines: 05-geometry-operations.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -607,7 +607,7 @@ A variety of georeferencing techniques exist, including:
607
607
608
608
- Georectification based on known [ground control points](https://www.qgistutorials.com/en/docs/3/georeferencing_basics.html)
609
609
- Orthorectification, which also accounts for local topography
610
-
- Image [registration](https://en.wikipedia.org/wiki/Image_registration) is used to combine images of the same thing but shot from different sensors by aligning one image with another (in terms of coordinate system and resolution)
610
+
- Image [registration](https://en.wikipedia.org/wiki/Image_registration) is used to combine images of the same thing, but shot from different sensors by aligning one image with another (in terms of coordinate system and resolution)
611
611
612
612
R is rather unsuitable for the first two points since these often require manual intervention which is why they are usually done with the help of dedicated GIS software (see also Chapter \@ref(gis)).
613
613
On the other hand, aligning several images is possible in R and this section shows among others how to do so.
Copy file name to clipboardExpand all lines: 07-reproj.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Having a clearly defined CRS that all project data is in, and understanding how
30
30
Furthermore, learning about coordinate systems will deepen your knowledge of geographic datasets and how to use them effectively.
31
31
32
32
This chapter teaches the fundamentals of CRSs, demonstrates the consequences of using different CRSs (including what can go wrong), and how to 'reproject' datasets from one coordinate system to another.
33
-
In the next section we introduce CRSs in R, followed by Section \@ref(crs-setting) which shows how to get and set CRSs associated with spatial objects.
33
+
In the next section, we introduce CRSs in R, followed by Section \@ref(crs-setting) which shows how to get and set CRSs associated with spatial objects.
34
34
Section \@ref(geom-proj) demonstrates the importance of knowing what CRS your data is in with reference to a worked example of creating buffers.
35
35
We tackle questions of when to reproject and which CRS to use in Section \@ref(whenproject) and Section \@ref(which-crs), respectively.
36
36
Finally, we cover reprojecting vector and raster objects in Sections \@ref(reproj-vec-geom) and \@ref(reproj-ras) and modifying map projections in Section \@ref(mapproj).
The interactive web maps demonstrated in Section \@ref(interactive-maps) can go far.
913
913
Careful selection of layers to display, basemaps and pop-ups can be used to communicate the main results of many projects involving geocomputation.
914
-
But the web-mapping approach to interactivity has limitations:
914
+
But the webmapping approach to interactivity has limitations:
915
915
916
916
- Although the map is interactive in terms of panning, zooming and clicking, the code is static, meaning the user interface is fixed
917
917
- All map content is generally static in a web map, meaning that web maps cannot scale to handle large datasets easily
918
-
- Additional layers of interactivity, such a graphs showing relationships between variables and 'dashboards', are difficult to create using the web-mapping-approach
918
+
- Additional layers of interactivity, such a graphs showing relationships between variables and 'dashboards', are difficult to create using the webmapping-approach
919
919
920
920
Overcoming these limitations involves going beyond static web mapping and toward geospatial frameworks and map servers.
921
921
Products in this field include [GeoDjango](https://docs.djangoproject.com/en/4.0/ref/contrib/gis/)\index{GeoDjango} (which extends the Django web framework and is written in [Python](https://github.com/django/django))\index{Python}, [MapServer](https://github.com/mapserver/mapserver)\index{MapServer} (a framework for developing web applications, largely written in C and C++)\index{C++} and [GeoServer](https://github.com/geoserver/geoserver) (a mature and powerful map server written in Java\index{Java}).
922
922
Each of these is scalable, enabling maps to be served to thousands of people daily, assuming there is sufficient public interest in your maps!
923
923
The bad news is that such server-side solutions require much skilled developer time to set up and maintain, often involving teams of people with roles such as a dedicated geospatial database administrator ([DBA](https://wiki.gis.com/wiki/index.php/Database_administrator)).
924
924
925
-
Fortunately for R programmers, web-mapping applications can now be rapidly created with **shiny**.\index{shiny (package)}
925
+
Fortunately for R programmers, webmapping applications can now be rapidly created with **shiny**.\index{shiny (package)}
926
926
As described in the open source book [Mastering Shiny](https://mastering-shiny.org/), **shiny** is an R package and framework for converting R code into interactive web applications [@wickham_mastering_2021].
927
927
You can embed interactive maps in shiny apps thanks to functions such as <!--`tmap::renderTmap()` and -->[`leaflet::renderLeaflet()`](https://rstudio.github.io/leaflet/shiny.html).
928
-
This section gives some context, teaches the basics of **shiny** from a web-mapping perspective, and culminates in a full-screen mapping application in less than 100 lines of code.
928
+
This section gives some context, teaches the basics of **shiny** from a webmapping perspective, and culminates in a full-screen mapping application in less than 100 lines of code.
929
929
930
930
**shiny** is well documented at [shiny.posit.co](https://shiny.posit.co/), which highlights the two components of every **shiny** app: 'front end' (the bit the user sees) and 'back end' code.
931
931
In **shiny** apps, these elements are typically created in objects named `ui` and `server` within an R script named `app.R`, which lives in an 'app folder'.
932
-
This allows web-mapping applications to be represented in a single file, such as the [`CycleHireApp/app.R`](https://github.com/geocompx/geocompr/blob/main/apps/CycleHireApp/app.R) file in the book's GitHub repo.
932
+
This allows webmapping applications to be represented in a single file, such as the [`CycleHireApp/app.R`](https://github.com/geocompx/geocompr/blob/main/apps/CycleHireApp/app.R) file in the book's GitHub repo.
933
933
934
934
\BeginKnitrBlock{rmdnote}<divclass="rmdnote">In **shiny** apps these are often split into `ui.R` (short for user interface) and `server.R` files, naming conventions used by `shiny-server`, a server-side Linux application for serving shiny apps on public-facing websites.
935
935
`shiny-server` also serves apps defined by a single `app.R` file in an 'app folder'.
@@ -959,8 +959,8 @@ shinyApp(ui, server)
959
959
```
960
960
961
961
<divclass="figure"style="text-align: center">
962
-
<imgsrc="images/shiny-app.png"alt="Screenshot showing minimal example of a web-mapping application created with shiny."width="100%" />
963
-
<pclass="caption">(\#fig:lifeApp)Screenshot showing minimal example of a web-mapping application created with shiny.</p>
962
+
<imgsrc="images/shiny-app.png"alt="Screenshot showing minimal example of a webmapping application created with shiny."width="100%" />
963
+
<pclass="caption">(\#fig:lifeApp)Screenshot showing minimal example of a webmapping application created with shiny.</p>
964
964
</div>
965
965
966
966
The **user interface** (`ui`) of lifeApp is created by `fluidPage()`.
@@ -979,20 +979,20 @@ The example contains some of the components of a web mapping application impleme
979
979
980
980
The `CycleHireApp/app.R` script contains **shiny** functions that go beyond those demonstrated in the simple 'lifeApp' example (Figure \@ref(fig:CycleHireApp-html)).
981
981
These include `reactive()` and `observe()` (for creating outputs that respond to the user interface --- see `?reactive`) and `leafletProxy()` (for modifying a `leaflet` object that has already been created).
982
-
Such elements are critical to the creation of web-mapping applications implemented in **shiny**.
982
+
Such elements are critical to the creation of webmapping applications implemented in **shiny**.
983
983
A range of 'events' can be programmed including advanced functionality such as drawing new layers or subsetting data, as described in the shiny section of RStudio's **leaflet**[website](https://rstudio.github.io/leaflet/shiny.html).
984
984
985
985
\BeginKnitrBlock{rmdnote}<divclass="rmdnote">There are a number of ways to run a **shiny** app.
986
986
For RStudio users, the simplest way is probably to click on the 'Run App' button located in the top right of the source pane when an `app.R`, `ui.R` or `server.R` script is open.
987
987
**shiny** apps can also be initiated by using `runApp()` with the first argument being the folder containing the app code and data: `runApp("CycleHireApp")` in this case (which assumes a folder named `CycleHireApp` containing the `app.R` script is in your working directory).
988
988
You can also launch apps from a Unix command line with the command `Rscript -e 'shiny::runApp("CycleHireApp")'`.</div>\EndKnitrBlock{rmdnote}
989
989
990
-
Experimenting with apps such as `CycleHireApp` will build not only your knowledge of web-mapping applications in R, but also your practical skills.
990
+
Experimenting with apps such as `CycleHireApp` will build not only your knowledge of webmapping applications in R, but also your practical skills.
991
991
Changing the contents of `setView()`, for example, will change the starting bounding box that the user sees when the app is initiated.
992
992
Such experimentation should not be done at random, but with reference to relevant documentation, starting with `?shiny`, and motivated by a desire to solve problems such as those posed in the exercises.
993
993
994
994
**shiny** used in this way can make prototyping mapping applications faster and more accessible than ever before (deploying **shiny** apps, https://shiny.posit.co/deploy/, is a separate topic beyond the scope of this chapter).
995
-
Even if your applications are eventually deployed using different technologies, **shiny** undoubtedly allows web-mapping applications to be developed in relatively few lines of code (86 in the case of CycleHireApp).
995
+
Even if your applications are eventually deployed using different technologies, **shiny** undoubtedly allows webmapping applications to be developed in relatively few lines of code (86 in the case of CycleHireApp).
996
996
That does not stop shiny apps getting rather large.
997
997
The Propensity to Cycle Tool (PCT) hosted at [pct.bike](https://www.pct.bike/), for example, is a national mapping tool funded by the UK's Department for Transport.
998
998
The PCT is used by dozens of people each day and has multiple interactive elements based on more than 1000 lines of [code](https://github.com/npct/pct-shiny/blob/master/regions_www/m/server.R)[@lovelace_propensity_2017].
@@ -1004,7 +1004,7 @@ This way your prototype web applications should be limited not by technical cons
<pclass="caption">(\#fig:CycleHireApp-html)CycleHireApp, a simple web-mapping application for finding the closest cycle hiring station based on your location and requirement of cycles. Interactive version available online at: r.geocompx.org.</p>
1007
+
<pclass="caption">(\#fig:CycleHireApp-html)CycleHireApp, a simple webmapping application for finding the closest cycle hiring station based on your location and requirement of cycles. Interactive version available online at: r.geocompx.org.</p>
1008
1008
</div>
1009
1009
1010
1010
@@ -1269,7 +1269,7 @@ E7. Create an interactive map of HDI in Africa:
1269
1269
1270
1270
1271
1271
1272
-
E8. Sketch on paper ideas for a web-mapping application that could be used to make transport or land-use policies more evidence-based:
1272
+
E8. Sketch on paper ideas for a webmapping application that could be used to make transport or land-use policies more evidence-based:
1273
1273
1274
1274
- In the city you live, for a couple of users per day
1275
1275
- In the country you live, for dozens of users per day
0 commit comments