An example in geoinformatics. The program calculates the average distance of a resident to the nearest playground within his city. In this example open data from the city of Rostock is used.
The program uses the following sources and services.
-
Anthropogene Überprägung der Konzeptbodenkarte 2018 (areas of Rostock where people live)
-
Gerätespielanlagen list of playgrounds
-
Direction API from openrouteservice.org
The script average-distance.py
simulates according to the following method.
-
Generation of random coordinates (uniform distribution) within the city limits.
-
Saving those coordinates that are within an inhabited are.
-
For each random coordinate: calculate the three nearest playgrounds (euclidean distance)
-
Using openrouteservice to calculate the actual distance (on foot) in meter of these three points.
-
Save the nearest random coordinate and the corresponding distance in
results.csv
. (Maybe you want to runaverage-distance.py
more than once, due to the api restrictions of openrouteservice.org) -
Calculate the average distance with
calc-average-from-csv.py
-
Using QGIS to visualize the coordinates and the ares on a map.
...