This project creates the region json files that are visualized on the SimRa project website. In essence, data on incidents in a SimRa region gathered by users of the SimRa app is mapped onto specific areas of the respective region, producing data to be displayed on a Leaflet map. Depending on their dangerousness score, junctions and street segments appear in green, yellow, orange or red. The dangerousness score describes the fraction of incidents relative to the number of total rides associated with the respective junction/segment, with incidents marked as scary weighing 4.4 times as much as regular incidents (4.4 is just the default value; the parameter can be tweaked as desired, see below for a detailed description of the parameters and their default values).
- Git
- Maven
- Java (probably 11 or higher)
For a specific SimRa region, you will need:
- incident data (obtained from https://github.com/simra-project/dataset), only Berlin thus far, but other data upon request (see instructions in bottom section)
- three files written by osmPreparation:
{region}_segments_complete_YYY-MM-DD.csv
,{region}_junctions_complete_YYY-MM-DD.csv
, as well as{region}_meta.json
.
The entry point for running this project is src/kotlin/main/Main.kt
.
A number of input parameters can be specified, with defaults being provided for each (except r
, region). Therefore, if the defaults are to be accepted only r
(region) needs to be specified.
-s
/--simraRoot
: the directory from which the incident data will be read.osmColoring/osm_data
by default.-r
/--region
: the region the computations shall be carried out for.-o
/--outputDir: the directory into which output data will be written, i.e.
{region}.json(the to-be-visualized data) as well as files containing meta-information (
{region}-meta.json,
{region_all-meta.json}) such as utilized cut-off values for input parameters listed below. Default:
osmColoring/output_data`.--osmDir
: the directory from which the data written byosmPreparation
will be read. Default:osmColoring/osm_data
.--scaryFactor
: the scariness factor is used as a multiplier for incidents that were marked asscary
. The default value is 4.4. This means that the weight of ascary
incident will correspond to 4.4 times the weight of a non-scary
incident.--minRides
: the minimum number of rides that need to be associated with a segment or junction for it to be included. Default is 50. Please note: whenminRides
is set to 1, the name of the output files will differ. Please refer to the section on output files for more information.--minScore
,--minScoreRides
: as described above, a junction/segment needs to have at leastminRides
associated with it to be included. UsingminScore
andminScoreRides
, this requirement can be overriden: junctions/segments with a dangerousness score of at leastminScore
only need to exhibit at leastminScoreRides
to be included.-i
/--ignore
(boolean): ignore irrelevant segments defined withminRides
,minScore
, andminScoreRides
. Default istrue
.-h
/--help
: print help message and exit.
Below is an example run configuration in IntelliJ IDEA, using the default values for the three I/O directories (simraroot
, osmDir
, outputdir
).
Output data (written to outputDir
):
{region}.json
: the GeoJson file containing a region's junctions and street segments as geometric shapes as well as information on their dangerousness; to be plotted on a Leaflet-map.{region}-meta.json
: as the title suggests, this file contains meta information such as the date, centroid and zoom level for the to-be-generated map, and a short description.- Please note that when
minRides
is set to 1 (i.e., all junctions and street segments with at least one ride associated with them will be included), the names of the two output files will be{region}_all.json
and{region}_all-meta.json
.
This project contains the SimRa project website as a submodule for the purpose of visualizing the resultant GeoJson data on a map. Analogous to the map of Berlin results already published, users can view the results for any region whose data they have access to.
This is how you can use the project website's code to plot your results:
- The SimRa project website is embedded in this project as a sub-module (perhaps you've already noticed the empty
simra-project.github.io
directory). In order to activate the submodule, execute the following commands:
git submodule init
git submodule update
- Move the files you've generated using this project (
{region}.json
/{region}_all.json
and{region}-meta.json
/{region}_all-meta.json
) intosimra-project.github.io/region
. - In
simra-project.github.io/resources/map-region.js
, add the respective region to theswitch (params.get("region"))
-block. Example:
case "augsburg":
region = "region/Augsburg.json";
regionMeta = "region/Augsburg-meta.json";
break;
- Start a local HTTP server (inside the top level directory or the
simra-project.github.io
subdirectory, doesn't really matter):python3 -m http.server
. In your browser, enterlocalhost:8000
. The directory structure will appear. If you're not already inside it, navigate into the directorysimra-project.github.io
. Selectmap.html
. In the browser address bar, add the respective URL search parameter for the region in question. Example:
http://localhost:8000/map.html?region=augsburg
- That's it! You should be able to view your results on a map.
- Rename RasterAPI