Introduction to Geospatial Techniques for Social Scientists in R
Author
Stefan Jünger, Anne-Kathrin Stroppe, Dennis Abel
In this exercise, we will work with the SoRa API to search for some data and link them to some input datasets. It is quite open in terms which datasets you want to use and how you want to link them. Generally, we recommend to have a closer look at the cheat sheet in the slides folder.
Exercises
Note🏋Exercise 1
Go ahead and register an PI key for the SoRa Geolinking API at https://sora.gesis.org/public/sora-user-mod/users/request-api-key
Caution💡Tip
Make sure to save this token somewhere safe.
Note🏋Exercise 2
Have a look at the IOER Monitor at https://monitor.ioer.de/ and search for some attributes you might find interesting.
Caution💡Tip
There’s a small British flag in the upper right corner to set the language to English.
Have you found something nice? Now let’s switch to the SoRa interfaces.
🏋️ Exercise 3
Corroborate of the attribute you find interesting can also be found in the SoRa datapicker.
Caution💡Tip
You can either use the online datapicker https://sora.gesis.org/public/datapicker/ or navigate the datapicker in R. You may want to have a look at the corresponding help file ?sora::sora_datapicker or the cheat sheet.
🏋Exercise 4
We are getting closer, it is time to test the connection to the API.
Register your API key in R
Test the connection :::
Caution💡Tip
There are several methods you can use to register your API key. To do it just for this session, you may want to store it in a text file and set the environment variable in R with Sys.setenv(SORA_API_KEY = readLines(<sora_key>)).
🏋Exercise 5
Load the synthetic geocoordinates in the data folder and define them as a custom dataset for sora. If you have your own coordinates, you can also use them. :::
Caution💡Tip
Custom datasets in sora can be defined using sora::sora_custom()
🏋Exercise 6
From now on, experiment freely with different linking endeavors. You can request data with a selection area comprising circles, squares or whatever you want. :::
Caution💡Tip
There are several methods you can use to register your API key. To do it just for this session, you may want to store it in a text file and set the environment variable in R with Sys.setenv(SORA_API_KEY = readLines(<sora_key>)).
Solutions
Tip✅ Solution 1
Well, I just clicked on the link of the website.
Tip✅ Solution 2
Well, I just clicked on the link of the website again.
Tip✅ Solution 3
Well, I just clicked on the link of the website again. Just kidding, if you want to see the geospatial datasets in the SoRa datapicker in R use this code:
sora::sora_datapicker("spatial")
# A tibble: 9,443 × 14
data_provider dataset_id datatype description geometry_type keywords label
<chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 IOER ioer-monitor… numeric Number of … Raster "" 1000…
2 IOER ioer-monitor… numeric Number of … Raster "" 1000…
3 IOER ioer-monitor… numeric Number of … Raster "" 5000…
4 IOER ioer-monitor… numeric Number of … Vector: Poly… "" Citi…
5 IOER ioer-monitor… numeric Number of … Vector: Poly… "" Dist…
6 IOER ioer-monitor… numeric Number of … Vector: Poly… "" Muni…
7 IOER ioer-monitor… numeric Number of … Vector: Poly… "" Muni…
8 IOER ioer-monitor… numeric Number of … Vector: Poly… "" Spat…
9 IOER ioer-monitor… numeric Number of … Vector: Poly… "" Stat…
10 IOER ioer-monitor… numeric Number of … Raster "" 1000…
# ℹ 9,433 more rows
# ℹ 7 more variables: required_permissions <chr>, service_provider <chr>,
# spatial_resolution <chr>, time_frame <int>, title <chr>, unit <chr>,
# url <chr>
Tip✅ Solution 4
# register the API keySys.setenv(SORA_API_KEY =readLines("sora_key"))# test the connectionsora::sora_available()
→ The provided coordinates have unique identifiers and are in a valid format.
→ The requested sora-provided geospatial dataset exists.
→ Chosen geospatial dataset: Percentage of flood zones to reference area (2021,
1000m Raster) from IOER-Monitor (IOER)
→ Chosen linkage: Aggregate attribute within circle on raster with numeric
field - Geocoded Dataset: Vector: Point | Geospatial Dataset: Raster -
numeric
→ The requested linkage is plausible and fits the chosen geospatial dataset.
All provided parameters are valid, including their values.
→ All required permissions for accessing the data are available.
→ Total number of provided coordinates: 500 (valid: 500, having null values:
0).
→ Number of coordinates located within the bounding box of the geospatial
dataset: 500 (outside: 0).
→ All required external services are available.
Information from SoRa:
• Hello from the SoRa-X-API. Everything is in good order. Have a nice day!
Waiting for results...
→ The linking job was created at 2026-04-22 15:31:48
→ The processing of the linking jobs has started at 2026-04-22 15:31:54
→ The processing of the linking job has finished at 2026-04-22 15:32:31
→ The total count of input items is 500 (successfully linked: 500)
→ Linking method: aggregate_attribute
→ Chosen linking parameter: output = ['mean']; radius = 10000; selection_area =
circle
→ Chosen geospatial dataset: ioer-monitor-r01rg-2021-1000m - Percentage of
flood zones to reference area (2021, 1000m Raster) from IOER-Monitor (IOER)
Information from SoRa:
• Hello from the SoRa-X-API. Everything is in good order. Have a nice day!
→ The provided coordinates have unique identifiers and are in a valid format.
→ The requested sora-provided geospatial dataset exists.
→ Chosen geospatial dataset: Percentage of flood zones to reference area (2021,
1000m Raster) from IOER-Monitor (IOER)
→ Chosen linkage: Aggregate attribute within square on raster with numeric
field - Geocoded Dataset: Vector: Point | Geospatial Dataset: Raster -
numeric
→ The requested linkage is plausible and fits the chosen geospatial dataset.
All provided parameters are valid, including their values.
→ All required permissions for accessing the data are available.
→ Total number of provided coordinates: 500 (valid: 500, having null values:
0).
→ Number of coordinates located within the bounding box of the geospatial
dataset: 500 (outside: 0).
→ All required external services are available.
Information from SoRa:
• Hello from the SoRa-X-API. Everything is in good order. Have a nice day!
Waiting for results...
→ The linking job was created at 2026-04-22 15:32:35
→ The processing of the linking jobs has started at 2026-04-22 15:32:44
→ The processing of the linking job has finished at 2026-04-22 15:33:20
→ The total count of input items is 500 (successfully linked: 500)
→ Linking method: aggregate_attribute
→ Chosen linking parameter: length = 10000; output = ['mean']; selection_area =
square
→ Chosen geospatial dataset: ioer-monitor-r01rg-2021-1000m - Percentage of
flood zones to reference area (2021, 1000m Raster) from IOER-Monitor (IOER)
Information from SoRa:
• Hello from the SoRa-X-API. Everything is in good order. Have a nice day!
→ The provided coordinates have unique identifiers and are in a valid format.
→ The requested sora-provided geospatial dataset exists.
→ Chosen geospatial dataset: Percentage of flood zones to reference area (2021,
1000m Raster) from IOER-Monitor (IOER)
→ Chosen linkage: Aggregate attribute within isochrone on raster with numeric
field - Geocoded Dataset: Vector: Point | Geospatial Dataset: Raster -
numeric
→ The requested linkage is plausible and fits the chosen geospatial dataset.
All provided parameters are valid, including their values.
→ All required permissions for accessing the data are available.
→ Total number of provided coordinates: 500 (valid: 500, having null values:
0).
→ Number of coordinates located within the bounding box of the geospatial
dataset: 500 (outside: 0).
→ All required external services are available.
Information from SoRa:
• Hello from the SoRa-X-API. Everything is in good order. Have a nice day!
Waiting for results...
→ The linking job was created at 2026-04-22 15:33:24
→ The processing of the linking jobs has started at 2026-04-22 15:33:34
→ The processing of the linking job has finished at 2026-04-22 15:34:21
→ The total count of input items is 500 (successfully linked: 498)
→ Linking method: aggregate_attribute
→ Chosen linking parameter: output = ['mean']; interval = 10; routing_type =
time; selection_area = isochrone; transport_mode = foot-walking
→ Chosen geospatial dataset: ioer-monitor-r01rg-2021-1000m - Percentage of
flood zones to reference area (2021, 1000m Raster) from IOER-Monitor (IOER)
Warning in "function `sora_results()`": ! There are problems with rows 295 and 404.
ℹ To inspect the problems, call `sora_problems(...)` on your output.
Information from SoRa:
• Hello from the SoRa-X-API. Everything is in good order. Have a nice day!