The R statistical environment can be obtained for Windows, Macintosh and Linux from www.r-project.org
Rstudio, a modern graphical development environment for R, is also recommended and may be obtained from www.rstudio.com. The following instructions assume an installation of Rstudio.
The examples employ a number of packages to provide required functionality. These may be installed from inside R or Rstudio by issuing the following commands:
install.packages(c("tidyverse", "sf", "here", "units", "tmaptools",
"tmap", "knitr", "mapdeck", "googleway",
"mapview", "devtools", "dodgr", "viridisLite"))
devtools::install_github("HughParsonage/PSMA")
The interactive examples can then be created locally by opening the R markdown files, that have a .Rmd suffix, and click on the knit button in Rstudio.
The miniconda tools are recommended for management of python installations. The commands below should be executed in the terminal (Mac/Linux) or the command prompt (Windows). Screenshots for windows are included.
The steps are:
Install the latest version of miniconda
Create virtual environment by opening a terminal (Mac/Linux) or Anaconda prompt (Windows),
python
folder. This command depends on where you have extracted the zip file. For example, you may use cd GeospatialStroke\python
instead of cd geo-demo\python
.conda config --prepend channels conda-forge
conda create -n GEO --strict-channel-priority --yes python=3 --file requirements.txt
conda activate GEO
python -m ipykernel install --user --name GEO --display-name "Python (GEO)"
jupyter lab
A Jupyter notebook server will run in your browser - select either example1.pynb
or example2.pynb
to open the examples.
You are now ready to experiment with the Python examples.
In future sessions only the following commands are required to start the notebook:
conda activate GEO
jupyter lab
Online services which offer an interface to their applications will sometimes require use of an API key, or application programming interface key. This key should be unique for each user, developer or application making use of the service as it is a way for the provider to monitor and, where applicable, charge for use.
Two major mapping platforms that require an API key are Google Maps and Mapbox, both of which are used in the second version of the catchment basin example. At the time of writing both allow unrestricted use of the mapping API. However, Google has limits on the other services it offers such as geocoding and direction services.
Both Google and Mapbox require users create an account.
The required Google API keys may be obtained by following instructions provided by Google
The required Mapbox token may be obtained by following instructions provided by Mapbox