Self-hosted service
geocompx/geocompr avatar
geocompx/geocompr

Geocomputation with R is a book repository, and its package versions outlive the R releases it teaches

Geocomputation with R: an open source book

1,796 stars619 forksRNOASSERTION

At a glance

What is it?
geocompr hosts the code and prose behind the open source book Geocomputation with R, published by CRC Press and readable free at r.geocompx.org. It is the best free structured introduction to spatial data in R, and the repository has a custom licence plus a documentation convention that trips up contributors.
Who is it for?
Work through this book if you are learning geospatial analysis in R, since the chapters and the runnable code are the same artefact and you can read it without installing anything. Do not treat the repository as a package to depend on: it is a book, it ships no library, and its licence is custom rather than a standard open source licence.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 54 days ago.
What is it written in?
Mainly R, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 7, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • geocompx/geocompr1,796 ★ · +2
Star history
Repository2026-10-162026-11-07
geocompx/geocompr1.8k1.8k

2 Stars in the last 22 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

A book whose code blocks are the same files as its chapters

The repository is the source of a book, not a library. The top level makes that obvious: `01-introduction.Rmd` through `16-synthesis.Rmd` are the chapters, and `_01-ex.Rmd` through `_15-ex.Rmd` are the exercises.

Everything else in the root supports rendering them. `index.Rmd` is the book landing page, `_bookdown.yml` configures the bookdown site, `_output.yml` the output formats, and `DESCRIPTION` makes the directory a valid R package skeleton. There are also `benchmarks.csv`, `code/`, `extdata/` for data files, `images/`, `apps/` for the Shiny applications, and two BibTeX files, `geocompr.bib` and `CITATION.bib`, with a separate `CITATION_ed1.bib` for the first edition.

The README says that `README.md` is generated from `README.Rmd` and should be updated by rendering that source file.

The authors are Robin Lovelace, Jakub Nowosad and Jannes Muenchow, and the published citation in the README is Lovelace, Nowosad and Muenchow (2025), Geocomputation with R, The R Series, CRC Press.

Three ways to read it, and none of them need a local install

The book and its code are available through several online services, and the choice affects what you can do with them.

The first edition is published by CRC Press in the R Series and can be read at bookdown.org/robinlovelace/geocompr/. The latest version is at r.geocompx.org, with geocompx.github.io/geocompr as a stated backup.

For running the code without installing R packages, the README carries a Binder badge pointing at mybinder.org for the main branch with an RStudio path, plus an RStudio Cloud project. There is also an Open in GitHub Codespaces badge wired to a specific devcontainer, a `.devcontainer.json` in the repository root, and a machine type of basicLinux32gb. A Docker badge points at a separate geocompx/docker repository.

That is an unusually complete set of ways to get a working environment without touching your own machine, and it is the practical answer to the main obstacle in learning geospatial R: the dependency stack. The chapters build on sf and terra, and on tmap for figures, so a working stack is not trivial to assemble by hand.

The README includes a GitHub Actions badge labelled Render.

The second edition replaced raster with terra, mlr with mlr3 and tmap v3 with v4

The README's most useful content is a commented-out summary of what changed between editions. It is inside an HTML comment, so it does not render on GitHub, which is itself a small documentation trap, but the list describes the actual migration a reader of the first edition has to make.

`raster` was replaced with `terra` in chapters 1 through 7. `tmap` version 4 brought a different syntax and new features for the figures. The `mlr` package was replaced with `mlr3` in a pull request. Coordinate reference systems moved to WKT2 and SRID formatting because of changes in the PROJ library.

There are new chapters and sections too. A chapter on raster-vector interactions was split out of chapter 5, there is a new section on the dimensionally extended 9-intersection model, a new section on spherical geometry engines with the s2 package, a new section on the sfheaders package, and new parts on geographic metadata and connecting R with cloud services. The GIS bridge chapter was rewritten to include qgisprocess, Rsagacmd and rgrass, and the transportation chapter gained sections on routes and route networks. The old mlr-based code was replaced by mlr3, which also means anyone cross-referencing the first edition's code has to map package names.

The build itself was refactored to run on Docker images, and the Binder experience was improved specifically so people could try code before installing anything.

Contributing has a trap: the README names a file that does not exist

Contributions are explicitly welcome, and the README is unusually specific about what counts. It asks for improvements to the text such as clarifying unclear sentences and fixing typos, with a link to Yihui Xie's guidance on fixing documentation typos. It asks for code changes that do things more efficiently, content suggestions through the issue tracker, and improvements to the Geocompr solutions booklet hosted at r.geocompx.org/solutions.

Style is documented separately in `misc/our-style.md`, which is the file to read before submitting prose.

The README's blog post link uses `_01-ex.Rmd` as an example, matching the exercise-file naming pattern in the repository root.

A custom licence, not MIT, and not something GitHub can classify

The project's licence is recorded as Other, with GitHub unable to classify it and the LICENSE file being `LICENSE.md` rather than one of the standard names.

That is worth taking seriously for an educational work. A book published by CRC Press while its source is open is a specific arrangement: the code, the prose and the figures are governed by terms the project has set out in its own file, and they are not the same terms as the printed edition. The repository metadata cannot tell you what those terms are, so you have to read LICENSE.md.

This is a licensing note and not legal advice. The practical guidance is narrow: if you are teaching from the book, adapting a chapter for a course, or reusing a figure in your own work, read LICENSE.md before you assume the MIT permissions you would get from most R packages.

The citation requirement in the README is separate from the licence and applies regardless: the project asks that you cite the book, and supplies CITATION.bib for that purpose.

Latest tagged release is from 2022 while the repository is pushed to in 2026

The release history and the commit history tell different stories, and for a book the distinction is more meaningful than it would be for a library.

The most recent GitHub release is 1.9.1-2, dated 2022-06-12. Before that, 1.9.1 on 2022-02-15 is described as the second edition, part 1, pre peer review, and 1.9 on 2021-08-27 is the final version of the first edition.

Yet the repository is not archived and the last push was on 2026-09-14. The README also points to a 2024 blog post announcing that the second edition is complete, and the suggested citation is dated 2025.

So the tags lag the work. That is normal for a book project where the deliverable is the hosted site rather than a versioned artifact, but it has a direct consequence: `r.geocompx.org` reflects main, not the 1.9.1-2 tag, and code in the book may depend on R package versions that changed after the last tag.

For a learner this is mostly harmless, because you are reading the current text. For anyone pinning examples to a version, there is no tag that matches what the site currently shows.

What this is not, and when to use something else

There is no library here. `geocompr` does not appear as a package you install to get spatial functions, and installing the repository as an R package would give you documentation and data, not a new API. If you want spatial analysis in R, you install `sf` and `terra`, and this book tells you how to use them.

That framing also means the book is not the fastest route to a specific task. It is organised as a progressive course through spatial data, from the introduction through spatial data, attribute operations, spatial operations, geometry operations, raster-vector interaction, reprojection, reading writing and plotting, mapping, GIS bridges, algorithms, spatial cross-validation, transport, location and ecology.

A second limitation is the R-ecosystem coupling. The book teaches a specific stack, and the second edition moved it to terra, tmap v4, mlr3 and s2. Readers using a different programming language or package set may be able to reuse the concepts but will need to adapt the code.

A third is that this is one book's opinion. The chapter order, the choice to use sf as the vector layer throughout, and the emphasis on reproducible workflows are that of three authors. Where it disagrees with your existing conventions, you now have two authorities and one citation.

Why the exercises matter more than the chapters

The `_01-ex.Rmd` through `_15-ex.Rmd` files hold the exercises, and there is a solutions booklet at r.geocompx.org/solutions, hosted separately from the book itself.

For a self-taught reader this is the most underused part of the repository. The chapters explain, the exercises ask you to reproduce, and the solutions let you check. A large contributor list in the README, with names including recognised R package authors, suggests the exercise set has been worked through by people who know the packages well rather than by the authors alone.

The README also documents a convention for updating the solutions, with a blog post explaining how solutions live in files such as `_01-ex.Rmd`. That is what makes the solutions maintainable rather than a stale appendix, and it is why contributing a corrected solution is a well-defined contribution rather than a vague one.

If you are using this book to teach, that is the part to fork. The solutions are the assessment layer, and having them as R Markdown that gets rendered with the rest means your version stays consistent with your edits to the prose.

Editorial conclusion

Work through this book if you are learning geospatial analysis in R, since the chapters and the runnable code are the same artefact and you can read it without installing anything. Do not treat the repository as a package to depend on: it is a book, it ships no library, and its licence is custom rather than a standard open source licence. Verify first that the examples still run on your R version, because the most recent tagged release is 1.9.1-2 from 2022 while the repository itself was pushed to on 2026-09-14.

Frequently asked questions

Is Geocomputation with R free to read?

Yes. The latest version is available at r.geocompx.org, with geocompx.github.io/geocompr as a stated backup, and the first edition can be read at bookdown.org/robinlovelace/geocompr/. The printed edition is published by CRC Press in the R Series.

Can I run the Geocomputation with R code without installing R packages?

The README links a Binder project, an RStudio Cloud project, a GitHub Codespaces devcontainer and a separate Docker repository, so there are several ways to get a working environment. A .devcontainer.json in the repository root backs the Codespaces option.

What changed between the first and second editions of Geocomputation with R?

The README's change list records the replacement of raster with terra in chapters 1 to 7, updated figures for tmap version 4, mlr replaced by mlr3, WKT2 and SRID coordinate reference system formats, a new chapter on raster-vector interactions, sections on DE-9IM, s2 and sfheaders, and a rewritten GIS bridge chapter covering qgisprocess, Rsagacmd and rgrass.

How do I contribute to geocompr?

The README asks for text improvements such as typo fixes, more efficient code, content suggestions through the issue tracker, and improvements to the solutions booklet at r.geocompx.org/solutions. The book's style is documented in misc/our-style.md.

What licence applies to Geocomputation with R?

The repository uses a custom licence in LICENSE.md, and GitHub records the licence as Other because it cannot classify it. This is a licensing note and not legal advice, so read LICENSE.md before reusing code, prose or figures.

How do I cite Geocomputation with R?

The README gives the citation as Lovelace, Robin, Jakub Nowosad and Jannes Muenchow (2025). Geocomputation with R. The R Series. CRC Press, and the repository provides CITATION.bib for this purpose.

Official sources

  1. geocompx/geocompr on GitHub
  2. Issues
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/geocompx-geocompr.svg)](https://hysenlabs.com/projects/geocompx-geocompr)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/geocompx-geocompr.svg)](https://hysenlabs.com/projects/geocompx-geocompr)

Was this useful?