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

Rev1 #109

Merged
merged 137 commits into from
Oct 28, 2017
Merged

Rev1 #109

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
f1dc6e7
rev.md added
Nowosad Oct 21, 2017
dd85ff9
moved q
Nowosad Oct 21, 2017
f312fc0
q merge
Nowosad Oct 21, 2017
005e9b5
phase updated
Nowosad Oct 21, 2017
43e4a33
geolibrary -> spatial library and example
Robinlovelace Oct 21, 2017
df1b821
Merge branch 'rev1' of github.com:Robinlovelace/geocompr into rev1
Robinlovelace Oct 21, 2017
64c18ba
Update rev.md
Robinlovelace Oct 21, 2017
b072e59
Update review
Robinlovelace Oct 21, 2017
1aaae3c
right arrow removed
Nowosad Oct 21, 2017
d884ac8
geostatistical -> spatial statistics
Nowosad Oct 21, 2017
0c94b3a
Address reviewer issue regarding sp and the tidyverse
Robinlovelace Oct 21, 2017
f326aaa
Merge branch 'rev1' of github.com:Robinlovelace/geocompr into rev1
Robinlovelace Oct 21, 2017
c7e9b4d
delete (such as GEOS as GDAL)
Nowosad Oct 21, 2017
51badfc
updated rev
Nowosad Oct 21, 2017
f366375
functions -> scripts and functions (more general, lower expectations)
Robinlovelace Oct 21, 2017
575f547
Update text in c1 - more accessible
Robinlovelace Oct 21, 2017
801f98e
Improve flow in c1 and link to wider open source movement
Robinlovelace Oct 21, 2017
4e56725
MULTIPOLYGON s -> MULTIPOLYGON geometries
Nowosad Oct 21, 2017
7378344
sf classes update
Nowosad Oct 21, 2017
d03067d
delete "Figure based on the Open Geospatial Consortium document [06-1…
Nowosad Oct 21, 2017
8a53516
Refactor section 1.3.
Robinlovelace Oct 21, 2017
6d3a600
Merge branch 'rev1' of github.com:Robinlovelace/geocompr into rev1
Robinlovelace Oct 21, 2017
cf23f78
Fix issue with 'you'
Robinlovelace Oct 21, 2017
4a0981d
Generalise discussion of Python.
Robinlovelace Oct 21, 2017
e1e4e6b
Mention IDEs and that RStudio is a Java program!
Robinlovelace Oct 21, 2017
6d4c5f4
Minor improvement to grammar
Robinlovelace Oct 21, 2017
25c71af
Refine index prose
Robinlovelace Oct 21, 2017
4e302b7
Fix #101
Robinlovelace Oct 21, 2017
40dea54
Add hyperlink to the R Journal
Robinlovelace Oct 21, 2017
74d7df5
sf is no longer described as bleeding edge
Robinlovelace Oct 22, 2017
742f5ea
Fix typo and improve prose surrounding discussion of GDS
Robinlovelace Oct 22, 2017
0949e0c
Mark 2 more issues as fixed
Robinlovelace Oct 22, 2017
e56bbef
Fix issue around 'feature complete' and improve and shorten surroundi…
Robinlovelace Oct 22, 2017
3e73fb3
Address 'transition by whom' comment, demonstrate as_st_sf()
Robinlovelace Oct 22, 2017
4fcac8d
Document issue as fixed
Robinlovelace Oct 22, 2017
b126901
Fix issue with geographic vs projected CRS description
Robinlovelace Oct 22, 2017
190d531
Comment-out superfluous text
Robinlovelace Oct 22, 2017
fc7ec84
Refaction 2.1: shorter, simpler, better plots
Robinlovelace Oct 22, 2017
8a2d3cf
Add vector plots
Robinlovelace Oct 22, 2017
8090d3c
Mention scientific notation, cross-ref coordinate reference systems.
Robinlovelace Oct 22, 2017
1242ba4
Fix minor issues (primarily cross references) in c2
Robinlovelace Oct 22, 2017
2c4771e
Exercises placeholder
Nowosad Oct 22, 2017
bc0dc63
rev updated
Nowosad Oct 22, 2017
bcf18a3
build error fix
Nowosad Oct 23, 2017
7e0f881
build error fix
Nowosad Oct 23, 2017
195a8fe
ok
Nowosad Oct 23, 2017
d59b825
new gh issue
Nowosad Oct 23, 2017
89def30
test travis build
Nowosad Oct 23, 2017
2593d3b
Update geoportal text, with links to data.gov and sentinels api
Robinlovelace Oct 23, 2017
fd953ec
Merge branch 'rev1' of github.com:Robinlovelace/geocompr into rev1
Robinlovelace Oct 23, 2017
5097079
small clean
Nowosad Oct 23, 2017
e9d99e6
Merge branch 'rev1' of github.com:Robinlovelace/rgeobook into rev1
Nowosad Oct 23, 2017
7ed1398
Fix #106
Robinlovelace Oct 23, 2017
7c19cae
Update rmdnote explaining list cols in data.frames
Robinlovelace Oct 23, 2017
de42293
rephrasing R/Python comparison
jannes-m Oct 23, 2017
2d1c004
Refactor pkg-loading code chunk
Robinlovelace Oct 23, 2017
c23c5a0
Make install requirements note sf-specific
Robinlovelace Oct 23, 2017
a27e3f7
Remove scientific notation
Robinlovelace Oct 23, 2017
cc3e2c0
Tweak text around Python - make it more concise
Robinlovelace Oct 23, 2017
a75bb4a
Update text around Python. Seem OK to you @Jannes-m? Aiming to make t…
Robinlovelace Oct 23, 2017
f979351
Add SP post as a reference
Robinlovelace Oct 23, 2017
71a53f7
Fix issues in description of st_join()
Robinlovelace Oct 24, 2017
7003fde
Fix 'of course' issue
Robinlovelace Oct 24, 2017
89633d9
list columns -> geometry column
Nowosad Oct 24, 2017
1cf2648
rev updated
Nowosad Oct 24, 2017
2a3a84a
w parameter focal function
jannes-m Oct 24, 2017
5ab247f
Merge branch 'rev1' of github.com:Robinlovelace/geocompr into rev1
jannes-m Oct 24, 2017
aed8fb7
slight change in rasterbrick/stack text
Nowosad Oct 24, 2017
0c50371
raster* sugestion
Nowosad Oct 24, 2017
03a5e01
typo fix
Nowosad Oct 24, 2017
99d8b02
Merge branch 'rev1' of github.com:Robinlovelace/rgeobook into rev1
Nowosad Oct 24, 2017
31c2a15
Use pacman p_load
Robinlovelace Oct 24, 2017
a07c082
Add pacman to Imports
Robinlovelace Oct 24, 2017
49ecd05
Revert "Add pacman to Imports"
Robinlovelace Oct 25, 2017
7259245
Revert "Use pacman p_load"
Robinlovelace Oct 25, 2017
ea9189b
Use library() to load packages for simplicity
Robinlovelace Oct 25, 2017
9d2072e
Simplify text around loading/installing pkgs
Robinlovelace Oct 25, 2017
753d553
Don't load packages twice
Robinlovelace Oct 25, 2017
716a86f
Mention that pkgs should be up-to-date
Robinlovelace Oct 25, 2017
fc39c0f
Fix grammar: remove superfluous commas
Robinlovelace Oct 25, 2017
d061bb2
Make target audience issue for future
Robinlovelace Oct 25, 2017
2542924
Tweak prose: focus on geometry
Robinlovelace Oct 25, 2017
db001dc
Fix issue, define 'sticky'
Robinlovelace Oct 25, 2017
dfeef58
Mark another issue as fixed
Robinlovelace Oct 25, 2017
039a2ca
Fix typo
Robinlovelace Oct 25, 2017
f561651
Replace MULTIPOLYGON text with rmdnote
Robinlovelace Oct 25, 2017
3061fc4
Remove remotes
Robinlovelace Oct 25, 2017
c3ee266
Define what we mean by 'liberating' in c1
Robinlovelace Oct 25, 2017
a8bfbe1
Add reproducibility reference
Robinlovelace Oct 25, 2017
88fc0ee
Define reproducibility
Robinlovelace Oct 25, 2017
e9ddf06
Mark reproducility issue as fixed
Robinlovelace Oct 25, 2017
ab0854c
library cleaning
Nowosad Oct 26, 2017
7e5e41c
Fix various issues with Figure 2.6
Robinlovelace Oct 26, 2017
4d34eb4
Mark Fig 2.6 issue as fixed
Robinlovelace Oct 26, 2017
59f701c
Add another exercise to c2, rename section
Robinlovelace Oct 26, 2017
8d10971
Make solutions vignette reproducible
Robinlovelace Oct 26, 2017
8114404
Add solution to new exercise in vignette
Robinlovelace Oct 26, 2017
0e6161c
Add paragraph and code chunk on exploring crss. @Nowosad do we still …
Robinlovelace Oct 26, 2017
d1617b0
small crs clean
Nowosad Oct 26, 2017
46073be
reverse order of plots
Nowosad Oct 26, 2017
7c53c21
or -> many
Nowosad Oct 26, 2017
ae569f9
package loading in ch5 cleaned
Nowosad Oct 26, 2017
75bfac2
st_proj_info() is about projects not CRSs
Robinlovelace Oct 26, 2017
5e7ac9a
harmonizing with master
jannes-m Oct 27, 2017
4aa643d
outlining target audience
jannes-m Oct 27, 2017
cb71b7a
deleting reviewer comments from target audience
jannes-m Oct 27, 2017
a643980
books to compare with
jannes-m Oct 27, 2017
820b701
further rspatial remark
jannes-m Oct 27, 2017
44668d6
example of [[ and $ for raster stacks
jannes-m Oct 27, 2017
85d4edc
typos, you and extend example
jannes-m Oct 27, 2017
e471a95
Add non-overlapping joins section
Robinlovelace Oct 27, 2017
0cab622
Use na.omit() to neaten code
Robinlovelace Oct 27, 2017
851c66b
origin example and figure captions
jannes-m Oct 27, 2017
e539579
updating rev
jannes-m Oct 27, 2017
2aab290
Merge branch 'rev1' of github.com:Robinlovelace/geocompr into rev1
jannes-m Oct 27, 2017
d247261
name of the geometry column
jannes-m Oct 27, 2017
ed18b20
adding nolan xml book
jannes-m Oct 27, 2017
dd9e85b
kml example
jannes-m Oct 27, 2017
e996096
update rev
jannes-m Oct 27, 2017
8f7a31b
crs part moved and make_EPSG reused
Nowosad Oct 27, 2017
f533f31
Fixes to non-touching join section
Robinlovelace Oct 27, 2017
606fd0f
Merge branch 'rev1' of github.com:robinlovelace/geocompr into rev1
Robinlovelace Oct 27, 2017
526f0e1
Finishing non-overlapping joins section
Robinlovelace Oct 27, 2017
5e81770
Final fixes to new section - 4.2.4
Robinlovelace Oct 27, 2017
747de56
Mark another issue as fixed
Robinlovelace Oct 27, 2017
186301a
Fix typos in c4
Robinlovelace Oct 27, 2017
9264d08
Comment-out osm_tiles part for travis
Robinlovelace Oct 27, 2017
979b8b6
Update rmdnote on geometry col name
Robinlovelace Oct 28, 2017
678cd3a
Update why-simple-features section
Robinlovelace Oct 28, 2017
f9a349e
Mark another issue as fixed
Robinlovelace Oct 28, 2017
87e3bc5
Fix typo in c2
Robinlovelace Oct 28, 2017
e18bdce
Shorten and improve prose in c2
Robinlovelace Oct 28, 2017
daef071
Fix typo in c3
Robinlovelace Oct 28, 2017
9341211
Improve subsetting section with nz example
Robinlovelace Oct 28, 2017
3fc5f0f
Mark subsetting issue as fixed
Robinlovelace Oct 28, 2017
6c09842
Close last 'Robin' issue
Robinlovelace Oct 28, 2017
1616402
Use dev version of spData
Robinlovelace Oct 28, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 58 additions & 44 deletions 01-introduction.Rmd

Large diffs are not rendered by default.

261 changes: 169 additions & 92 deletions 02-spatial-data.Rmd

Large diffs are not rendered by default.

29 changes: 21 additions & 8 deletions 03-attribute-operations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ attributes(methods(class = "sf"))$info %>%

Many of these functions, including `rbind()` (for binding rows of data together) and `$<-` (for creating new columns) were developed for data frames.
A key feature of `sf` objects is that they store spatial and non-spatial data in the same way, as columns in a `data.frame` (the geometry column is typically called `geometry`).

```{block2 type = 'rmdnote'}
The geometry column of `sf` objects is typically called `geometry` but any name can be used.
The following command, for example, creates a geometry column named `g`:
`st_sf(data.frame(n = world$name_long), g = world$geom)`.
This enables geometries imported from spatial databases to have a variety of names such as `wkb_geometry` and `the_geom`.
```

`sf` objects also support `tibble` and `tbl` classes used in the tidyverse, allowing 'tidy' data analysis workflows for spatial data.
Thus **sf** enables the full power of R's data analysis capabilities to be unleashed on geographic data.
Before using these capabilities it's worth re-capping how to discover the basic properties of vector data objects.
Expand Down Expand Up @@ -256,10 +264,6 @@ world8 = dplyr::select(

This generates the same result --- verify this with `identical(world7, world8)` --- in the same number of lines of code, but in a much more confusing way, starting with the function that is called last!

```{block2 type='rmdnote'}
The 'right arrow' `->` operator can be used to make the result be assigned at the end of a chaining process.
```

There are additional advantages of pipes from a communication perspective: they encourage adding comments to self-contained functions and allow single lines *commented-out* without breaking the code.

### Vector attribute aggregation
Expand Down Expand Up @@ -433,7 +437,9 @@ class(left_join4)
```

```{block2 type='rmdnote'}
It is possible to convert a data frame with a geometry list column, such as `left_join4`, into an `sf` object with `st_as_sf()`, as follows: `st_as_sf(left_join4)`.
In most cases the geometry column is only useful in an `sf` object.
The geometry column can only be used for creating maps and spatial operations if R 'knows' it is a spatial object, defined by a spatial package such as **sf**.
Fortunately non-spatial data frames with a geometry list column (like `left_join4`) can be coerced into an `sf` object as follows: `st_as_sf(left_join4)`.
```

<!-- On the other hand, it is also possible to remove the geometry column of `left_join4` using base R functions or `dplyr`. -->
Expand Down Expand Up @@ -466,7 +472,6 @@ For this we need to divide a population column, here `pop`, by an area column ,
Using base R, we can type:

```{r}
data("world")
world_new = world # do not overwrite our original data
world_new$pop_dens = world_new$pop / world_new$area_km2
```
Expand Down Expand Up @@ -557,7 +562,6 @@ The following code recreates the raster dataset used in section \@ref(raster-cla
This demonstrates how the `raster()` function works to create an example raster named `elev` (representing elevations).

```{r, message=FALSE}
library(raster)
elev = raster(nrow = 6, ncol = 6, res = 0.5,
xmn = -1.5, xmx = 1.5, ymn = -1.5, ymx = 1.5,
vals = 1:36)
Expand Down Expand Up @@ -630,7 +634,16 @@ To extract all values or complete rows, you can use `values()` and `getValues()`
For multi-layered raster objects `stack` or `brick`, this will return the cell value(s) for each layer.
For example, `stack(elev, grain)[1]` returns a matrix with one row and two columns --- one for each layer.
<!-- In this example we have used cell ID subsetting, of course, you can also use row-column or coordinate indexing. -->
For multi-layer raster objects another way to subset is with `raster::subset()`, which extracts layers from a raster stack or brick. The `[[` and `$` operators can also be used.
For multi-layer raster objects another way to subset is with `raster::subset()`, which extracts layers from a raster stack or brick. The `[[` and `$` operators can also be used:

```{r, eval = FALSE}
r_stack = stack(elev, grain)
names(r_stack) = c("elev", "grain")
# three ways to extract a layer of a stack
raster::subset(r_stack, "elev")
r_stack[["elev"]]
r_stack$elev
```

Cell values can be modified by overwriting existing values in conjunction with a subsetting operation.
The following code chunk, for example, sets the upper left cell of `elev` to 0:
Expand Down
226 changes: 179 additions & 47 deletions 04-spatial-operations.Rmd

Large diffs are not rendered by default.

41 changes: 24 additions & 17 deletions 05-read-write-plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,17 @@ Nowadays, a vast amount of spatial data is available on the internet.
Best of all, much of it is freely available.
You just have to know where to look.
While we cannot provide a comprehensive guide to all available geodata, we point to a few of the most important sources.
Overall, geolibraries and geoportals facilitate the search and download of geodata.
Geolibraries are a very useful data source but often only contain data for a specific locations.
Then you might struggle to find the exact geolibrary matching his or her demands.
Here, geolibraries come to the rescue bundling the information of a collection of geolibraries.
If you are looking for data from all over the world, the [GEOSS portal](http://www.geoportal.org/) might be a good starting point.
We also would like you to point to the [EarthExplorer](https://earthexplorer.usgs.gov/) and the [Copernicus Open Access Hub](https://scihub.copernicus.eu/) for a wide variety of global datasets including multispectral and radar images.
European data is available from the Initiative for spatial information in the European Community ([INSPIRE](http://inspire-geoportal.ec.europa.eu/)).
This [Wikipedia article](https://en.wikipedia.org/wiki/Geoportal) lists a few more interesting geoportals.
Various 'geoportals' (web services providing geographic data such as the geospatial datasets in [Data.gov](https://catalog.data.gov/dataset?metadata_type=geospatial)) are a good place to start, providing a wide range of geographic data.
Geoportals are a very useful data source but often only contain data for a specific locations (see the [Wikipedia page on geoportals](https://en.wikipedia.org/wiki/Geoportal) for a list of geoportals covering many areas of the world).

To overcome this limitation some global geoportals have been developed.
The [GEOSS portal](http://www.geoportal.org/), for example, provides global remote sensing data.
Additional geoportals with global coverage and an emphasis on raster data include the [EarthExplorer](https://earthexplorer.usgs.gov/) and the [Copernicus Open Access Hub](https://scihub.copernicus.eu/).
A wealth of European data is available from the [INSPIRE geoportal](http://inspire-geoportal.ec.europa.eu/).

Typically, geoportals provide an interface that lets you query interactively the existing data (spatial and temporal extent, and product).
However, in this book we encourage you to create reproducible workflows.
Automated data downloads are often possible through simple download calls or specific APIs (e.g., have a look at the Sentinel API), which saves human working time, and allows to easily repeat and update this process in the future.
In many cases data downloads can be scripted via download calls to static URLs or APIs (see the [Sentinel API](https://scihub.copernicus.eu/twiki/do/view/SciHubWebPortal/APIHubDescription) for example), saving time, and enabling others to repeat and update the unglamorous data download process.

Traditionally, files have been stored on servers.
<!-- that's probably not the best example - replace it with something better -->
Expand All @@ -62,7 +61,7 @@ unzip(zipfile = "USA_parks.zip")
usa_parks = st_read("ne_10m_parks_and_protected_lands_area.shp")
```

Specific R packages providing an interface to geolibraries or geoportals are even more user-friendly (Table \@ref(tab:datapackages)).
Specific R packages providing an interface to spatial libraries or geoportals are even more user-friendly (Table \@ref(tab:datapackages)).

<!-- add sentinel2 package as soon as it is published on CRAN https://github.com/IVFL-BOKU/sentinel2-->
```{r datapackages, echo=FALSE}
Expand Down Expand Up @@ -220,7 +219,6 @@ In most cases, as with the ESRI Shapefile (`.shp`) or the `GeoPackage` format (`
`st_read()` guesses the driver based on the file extension, as illustrated for a `.gpkg` file below:

```{r}
library(sf)
vector_filepath = system.file("shapes/world.gpkg", package = "spData")
world = st_read(vector_filepath)
```
Expand Down Expand Up @@ -263,14 +261,25 @@ In these situations, it is possible to add the missing information using the `st
Please refer also to section \@ref(crs-intro) for more information.
```

As a final example, we will show how `st_read()` also reads KML files.
A KML file stores geographic information in XML format - a data format for the creation of web pages and the transfer of data in an application-independent way [@nolan_xml_2014].
Here, we access a KML file from the web.
This file contains more than one layer.
`st_layers()` lists all available layers.
We choose the first layer `Placemarks` and say so with the help of the `layer` parameter in `read_sf()`.

```{r}
url = "https://developers.google.com/kml/documentation/KML_Samples.kml"
st_layers(url)
kml = read_sf(url, layer = "Placemarks")
```

### Raster data

Similar to vector data, raster data comes in many file formats with some of them supporting even multilayer files.
**raster**'s `raster()` command reads in a single layer.

```{r, message=FALSE}
library(raster)
library(spDataLarge)
raster_filepath = system.file("raster/srtm.tif", package = "spDataLarge")
single_layer = raster(raster_filepath)
```
Expand Down Expand Up @@ -356,7 +365,6 @@ This can be done by specifying `GEOMETRY` inside of `layer_options`.
It could be either `AS_XY` for simple point datasets (it creates two new columns for coordinates) or `AS_WKT` for more complex spatial data (one new column is created which contains the well-known-text representation of spatial objects).

```{r, eval=FALSE}
library(spData)
st_write(cycle_hire_xy, "cycle_hire_xy.csv", layer_options = "GEOMETRY=AS_XY")
st_write(world_wkt, "world_wkt.csv", layer_options = "GEOMETRY=AS_WKT")
```
Expand Down Expand Up @@ -447,14 +455,13 @@ save_tmap(tm = tmap_obj, filename = "lifeExp_tmap.png")
<!-- a = plot(world["lifeExp"]) -->
<!-- ``` -->

On the other hand, on can save interactive maps as an HTML file using the `saveWidget()` function from the `htmlwidgets` package:
On the other hand, on can save interactive maps created in the `mapview` package as an HTML file or image using the `mapshot()` function:

<!-- example doesn't work, problem with colors I guess -->
```{r, eval=FALSE}
library(mapview)
library(htmlwidgets)
mapview_obj = mapview(world, zcol = "lifeExp", legend = TRUE)
saveWidget(mapview_obj, file = "my_interactive_map.html")
mapshot(mapview_obj, file = "my_interactive_map.html")
```

## Exercises
Expand Down
2 changes: 2 additions & 0 deletions 06-transform.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,5 @@ It is hidden from view for most of the time except when the object is printed bu
<!-- ### Shearing -->

<!-- Todo: add content on simplifying using mapshaper and other packages (e.g. sf) -->

### Exercises
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ Imports:
tabularaster,
tidyverse,
tmap
Remotes: Nowosad/spData
URL: https://github.com/Robinlovelace/geocompr
BugReports: https://github.com/Robinlovelace/geocompr/issues
LazyData: TRUE
RoxygenNote: 6.0.1
Suggests: knitr,
rmarkdown
Remotes: nowosad/spDataLarge,
nowosad/spData
VignetteBuilder: knitr
6 changes: 3 additions & 3 deletions code/02_crs_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ p2 = ggplot() +
coord_sf(datum = sf::st_crs(4326)) +
theme(axis.text = element_text(size = 4))

vector_crs = arrangeGrob(p1, p2, nrow = 1)
vector_crs = arrangeGrob(p2, p1, nrow = 1)

ggsave(plot = vector_crs,
filename = "figures/02_vector_crs.png",
Expand All @@ -40,6 +40,6 @@ pr1 = levelplot(new_raster, margin = FALSE, colorkey = FALSE)
pr2 = levelplot(new_raster2, margin = FALSE, colorkey = FALSE)

png(filename = "figures/02_raster_crs.png", width = 950, height = 555)
plot(pr1, split=c(1, 1, 2, 1), more=TRUE)
plot(pr2, split=c(2, 1, 2, 1))
plot(pr2, split=c(1, 1, 2, 1), more=TRUE)
plot(pr1, split=c(2, 1, 2, 1))
dev.off()
2 changes: 2 additions & 0 deletions code/sf_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ p_geometrycollection_sf = ggplot() +
)

## combine plot ------------
png("figures/sf-classes.png", height = 600, width = 600)
# Empty grob for spacing
b = nullGrob() # per @baptiste's comment, use nullGrob() instead of rectGrob()

Expand Down Expand Up @@ -240,3 +241,4 @@ vp = viewport(
pushViewport(vp)

mygb(x = c(1, 0.6, 0.6, 0), y = c(1, 0.4, 0.4, 0))
dev.off()
Binary file modified figures/02_raster_crs.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/02_vector_crs.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/sf-classes.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 added figures/vector_lonlat.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 added figures/vector_projected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 13 additions & 8 deletions index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,28 @@ Welcome to **geocompr**, the [website](http://robinlovelace.net/geocompr) of our
## Development {-}

Inspired by the **bookdown** [R package](https://github.com/rstudio/bookdown) we are developing this book in the open.
We decided to make the book open source to encourage contributions, ensure reproducibility and provide access to the material as it evolves.
We decided to make the book open source.
Why?
To encourage contributions, ensure reproducibility and provide access to the material as it evolves.

We're developing the book in four main phases.
We're in phase two and focussed on the application chapters, which we aim to be complete by December.
Drafts of other chapters will be added to this website as the project progresses.

The latest version is hosted at [robinlovelace.net/geocompr](http://robinlovelace.net/geocompr).
This website is kept up-to-date thanks to Travis, a continuous integration (CI) service.
Travis automatically rebuilds the book and finds bugs by reporting the 'build status' after every update.
1. Foundations
2. Basic applications
3. Geocomputation methods
4. Advanced applications

Currently we're working primarily on the second part, which we aim to be complete by December.
New chapters will be added to this website as the project progresses, hosted at [robinlovelace.net/geocompr](http://robinlovelace.net/geocompr) and kept up-to-date thanks to [Travis](https://travis-ci.org/Robinlovelace/geocompr).
Currently the build is:

[![Build Status](https://travis-ci.org/Robinlovelace/geocompr.svg?branch=master)](https://travis-ci.org/Robinlovelace/geocompr)

The version of the book you are reading now was built on `r Sys.Date()` and was built `r if(is_on_travis) "on [Travis](https://travis-ci.org/Robinlovelace/geocompr)" else "locally"`.
**bookdown** makes editing a book as easy as editing a wiki.
To do so, just click on the 'edit me' icon highlighted in the image below.
Which-ever chapter you are looking at, this will take you to the source [R Markdown](http://rmarkdown.rstudio.com/) file hosted on GitHub. If you have a GitHub account, you'll be able to make changes there and submit a pull request. If you do not, it's time to [sign-up](https://github.com/)!
**bookdown** makes editing a book as easy as editing a wiki, provided you have a GitHub account ([sign-up at github.com](https://github.com/)).
Once logged-in to GitHub, clicking on the 'edit me' icon highlighted in the image below will take you to the source [R Markdown](http://rmarkdown.rstudio.com/) where you can make changes:

[![](figures/editme.png)](https://github.com/Robinlovelace/geocompr/edit/master/index.Rmd)

Expand All @@ -61,7 +66,7 @@ if(!require(devtools)) {
devtools::install_github("robinlovelace/geocompr")
```

To build the book locally, clone or [download](https://github.com/Robinlovelace/geocompr/archive/master.zip) the repo and run the following line from the [project](https://github.com/Robinlovelace/geocompr/blob/master/geocompr.Rproj)'s root directory:
To build the book locally, clone or [download](https://github.com/Robinlovelace/geocompr/archive/master.zip) the [geocompr repo](https://github.com/Robinlovelace/geocompr/), open the [geocompr.Rproj project file](https://github.com/Robinlovelace/geocompr/blob/master/geocompr.Rproj) in RStudio and run the following lines:

```{r, eval=FALSE}
bookdown::render_book("index.Rmd") # to build the book
Expand Down
23 changes: 23 additions & 0 deletions preface.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Preface

## Who this book is for and who is it not for

This book is certainly aimed at people with an interest in spatial data analysis with the help of R.
This includes graduate students and researchers from geography, remote sensing and GIScience but also from other backgrounds as diverse as remote sensing, biogeosciences, ecology, forestry, transportation, ... <!-- please add further fields-->
This is the beauty of GIScience as it is applicable to all fields dealing with spatial phenomena.
And even more importantly, GIScience is not only a scientific domain but also used in the public sector and in the business world.
This makes our book, furthermore, interesting to people dealing with urban planning, transportation (logistics) and (geo-)marketing, ... <!-- please add further examples-->
This book also aims at persons with a solid knowledge of GIS technologies who wish to automate their spatial data analysis workflow in a reproducible manner on the command line.

Though we have tried our best to make our book as accessible as possible to a wide audience, people new to R might find it hard at first reading.
People who prefer a GUI-based GIS approach over the command line might find this book only interesting from a conceptual point of view.
Our programming language is R, and though we refer at times to other languages, people with an interest in geoprocessing with Python, Java, C++ or alike should probably look for another book.

<!-- to think about, not sure if needed but then this would be a good place to point out why our book might have advantages over the other books -->
## Justification, context
compare with:
- ASDAR
- An intro to R for spatial analysis and mapping
- Remote Sensing and GIS for ecologists
- Mapping and Environmental and Ecological Statistics with R (not really a competitor, I have ordered a copy, this book is really about modeling, and I would rather prefer the Zuur et al. books over it)
- http://rspatial.org/intr/index.html (haven't read it but might be more suitable for beginners, however, it does not consider sf; additionally, it provides more code than text, and hence, probably less explanations than our book)
Loading