OHDM Traveler

OHDM Traveler allows to create a route between a start and an end point under consideration of a given date in a OHDM DB. This project is based on the bachelor thesis written by Kirill Mishin.

The idea is that in the future the route can be calculated under consideration of historical events. At the moment two different types of persons (Noble and Farmer) are implemented to show an example of a route calculation under consideration of historical events. Restricted areas can be set to represent Pest zones, the Nobel will be informed of the Pest zone and therefore avoid them. On the other hand the Farmer is not informed and will traverse them.

Prerequisites

You have access to:

  • OHDM DB, more info here.
  • Rendering DB, more info here.

DB extensions:

Prerequisites setup guide:

  1. Download any osm file, you can find a small sample on our repository (sample.osm).

  2. Download the JDBC driver.

  3. Create these files: "intermediate.txt", "ohdm.txt", "rendering.txt".

    1. The format these files have to follow is described here.
  4. Create a Postgres DB with these extensions:

  5. Create these schemas: ohdm, intermediate, rendering.

  6. Create the intermediate DB.

  7. Create the OHDM DB.

  8. Create the Rendering DB (use -r option).

Deployment #1 (No REST Server, will only create results in the DB)

  1. Clone this repository or Download the precompiled jar under releases
  2. Create a schema in your Postgres DB where the routing results will be stored (routing for example).
  3. Under src/main/config you will find two example csv files, odhm_parameter_example.csv and search_parameter_example.csv. Insert in the second row of both files the required information, you can find more info about this under Parameters.
  4. Run jar or
  5. Set in build.gradle
mainClassName="traveler/TravelerMain.java"
  1. Run with gradlew
gradlew run --args="-r [path to ohdm_parameter.csv] -s [path to search_parameter.csv]"
  1. Optionally debug mode can be run with:
-d [true/false]
  1. The results will be stored in the routing schema.

Deployment #2 (With REST Server)

  1. Clone this repository or Download the precompiled jar under releases
  2. Create a schema in your Postgres DB where the routing results will be stored.
  3. Under src/main/java/config ythis csv file odhm_parameter_example.csv. Insert in the second row the required information, you can find more info about this under Parameters.
  4. Run jar or
  5. Set in build.gradle
mainClassName="traveler/RestTravelerMain"
  1. Run with gradlew
gradlew run --args="-r [path to ohdm_parameter.csv]"
  1. Optionally debug mode can be run with:
-d [true/false]
  1. REST Server waits for POST request With JSON Body
  2. REST Server replies with JSON

JSON Request format example

{"classofperson": "farmer", "transporttype": "bicycle", "waterwayincl": "true", "startpoint": {"latitude": "52.457907", "longitude": "13.527333"}, "endpoint": {"latitude": "52.444784", "longitude": "13.507886"}, "day": "2019-12-1", "restricted_area": {}}

JSON Reply format example

{"travel_time":"00:16:52.46232","request_id":"f84ff5dcc3dc4ecb85129c9fba05891e"}

Parameters

odhm_parameter.csv

"odhm_parameter.csv" has to follow this format:

host port username password dbname schema rendering_schema
host IP port number username password if required name of the DB name of scheme where results will be saved name of schema where rendering tables are stored

Example:

host port username password dbname schema rendering_schema
localhost 5432 admin superPassword OHDM routing rendering

search_parameter.csv

"search_parameter.csv" has to follow this format:

classofperson transporttype waterwayincl startpoint_latitude startpoint_longitude endpoint_latitude endpoint_longitude day

This is only for illustration, should follow csv format!

classofperson: [1, 2] (1 will traverse restricted areas, 2 will avoid them)

transporttype: [Walking, Horse, Carriage, Car, Boat, Bicycle] (Case insensitive)

waterwayincl: [true,flase]

startpoint_latitude: [startpoint latitude]

startpoint_longitude: [startpoint longitude]

endpoint_latitude: [endpoint latitude]

endpoint_longitude: [endpoint longitude]

day: [YYYY-MM-DD]

Example:

classofperson transporttype waterwayincl startpoint_latitude startpoint_longitude endpoint_latitude endpoint_longitude day
2 walking false 52.457907 13.527333 52.461204 13.513603 2019-12-1

IMPORTANT:

If you get 0:00 as result_time no route could be found for your request. In this case check the search_parameter (especially day and transporttype). It could also be helpful to look at the routing_topology table in your routing schema. If the table has to many entries, it might be helpful to only look at a certain area. The following SQL command could be useful in this case:

SELECT * from <routing_schema>.routing_topology where ST_Y(st_transform(ST_Centroid(line), 4326)) > lat1 and ST_Y(st_transform(ST_Centroid(line), 4326)) < lat2 and ST_X(st_transform(ST_Centroid(line), 4326)) > lon1 and ST_X(st_transform(ST_Centroid(line), 4326)) < lon2;