Skip to content

Commit

Permalink
Merge pull request #26 from GIScience/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
TimMcCauley authored Sep 21, 2017
2 parents 966fd2c + 6c15eb6 commit 67ae74e
Show file tree
Hide file tree
Showing 24 changed files with 783 additions and 183 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If you want to do contribute your improvements, please follow these steps:

## Installation

We suggest using docker to install and launch OpenRouteService backend. In short, run the following command under the source code tree will get everything done.
We suggest using docker to install and launch openrouteservice backend. In short, run the following command under the source code tree will get everything done.

```bash
cd docker && docker-compose up
Expand All @@ -46,8 +46,18 @@ For more details, check the [docker installation guide](docker/README.md).

## Usage

Instructions on how to use the endpoints of the running tomcat container will follow soon.
Openrouteservice offers a set of endpoints for different spatial purposes. They are served with the help of [Tomcat in a java servlet container](https://github.com/GIScience/openrouteservice/blob/master/openrouteservice/WebContent/WEB-INF/web.xml). By default you will be able to query the services with these addresses:

- `http://localhost:8080/name_of_war_archive/routes`
- `http://localhost:8080/name_of_war_archive/isochrones`
- `http://localhost:8080/name_of_war_archive/matrix`

Both `/locations` and `/geocoding` need additional setup steps for usage.
- `http://localhost:8080/name_of_war_archive/locations` | You will have to set up a locations database, for this please refer to [openrouteservice-tools](https://github.com/GIScience/openrouteservice-tools).
- `http://localhost:8080/name_of_war_archive/geocoding` | You can either use [Photon](https://github.com/komoot/photon), [Nominatim](https://github.com/openstreetmap/Nominatim) or [Pelias](https://github.com/pelias/pelias). One of these services must be installed in addition to the openrouteservice and configured in `app.config`.

Please find a detailed description of the api architecture on https://app.swaggerhub.com/apis/OpenRouteService/ors-api/.

## API Documentation

For an easy and interactive way to test the api, visit our [documentation](https://app.swaggerhub.com/apis/openrouteservice/ors-api/) at swaggerhub. After obtaining your key you can try out the different endpoints instantly and start firing requests.
Expand Down
34 changes: 17 additions & 17 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Install and Run OpenRouteService Backend via Docker
# Install and run openrouteservice with docker

It's possible and easy to install and launch the OpenRouteService backend service with Docker. Please note that the [Dockerfile](../Dockerfile) under the repository root directory is only for building the [WAR file](https://www.wikiwand.com/en/WAR_(file_format)).
Installing the openrouteservice backend service with **Docker** is quite straightforward. Please note that the [Dockerfile](../Dockerfile) located in the repository root directory is merely for building the [WAR file](https://www.wikiwand.com/en/WAR_(file_format)).

## Short version

run the following command within this `docker/` directory:
Run the following command within this `docker/` directory:

```bash
docker-compose up
sudo docker-compose up -d
```

It will:
This will:

1. build and test the OpenRouteService core from the local codebase with the `docker/conf/app.config.sample` as the config and the dataset for Heidelberg under `docker/data/` as sample data;
2. generate the built `ors.war` file and expose it to `docker/build/` directory;
3. launch the OpenRouteService backend service on port `8080`.
1. Build and test the openrouteservice core from the local codebase with the `docker/conf/app.config.sample` as the config file and the OpenStreetMap dataset for Heidelberg under `docker/data/` as sample data.
2. Generate the built `ors.war` file and expose it to `docker/build/` directory.
3. Launch the openrouteservice service on port `8080` within a tomcat container.

The service status is queryable via `http://localhost:8080/ors/health` endpoint. When the service is ready, go to `http://localhost:8080/ors/status` and it will show more detailed information. A URL for test can be `http://localhost:8080/ors/routes?profile=foot-walking&coordinates=8.676581,49.418204|8.692803,49.409465`. It should be able to provide the recommanded walking path in JSON format.
By default the service status is queryable via the `http://localhost:8080/ors/health` endpoint. When the service is ready, you will be able to request `http://localhost:8080/ors/status` for further information on the running services. If you use the default dataset you will be able to request `http://localhost:8080/ors/routes?profile=foot-walking&coordinates=8.676581,49.418204|8.692803,49.409465` for test purposes.

## Long version

Expand All @@ -34,20 +34,20 @@ or
docker-compose up ors-build
```

If everything goes fine, the built `ors.war` file can be found under the host directory, e.g. `/Users/user/build` in the above `docker run` command or `./build/` in the `docker-compose` command.
If everything goes fine, the built `ors.war` archive can be found under the shared host directory, e.g. `/Users/user/build` for the above `docker run` command or `./build/` for the `docker-compose` command.

### Run OpenRouteService
### Run openrouteservice

No matter whether the WAR file has been built or not, run
No matter whether the WAR file has been built or not, simply run:

```bash
docker-compose up
sudo docker-compose up
```

will get everything done with the sample Heidelberg dataset.
will take care of all steps with the sample Heidelberg dataset.

### Run with your own OSM dataset
### Run with your own OpenStreetMap dataset

Prepare the OSM dataset (formats support `.osm`, `.osm.gz`, `.osm.zip`, `.pbf`) in the `docker/data/` directory. Make your own `app.config` (check the sample with detailed comments [here](../openrouteservice/WebContent/WEB-INF/app.config.sample) for reference) and change the `APP_CONFIG` variable in `docker-compose.yml` to let it point to your customized `app.config`. Then, run `docker-compose up`.
Prepare the OSM dataset (formats supported are `.osm`, `.osm.gz`, `.osm.zip` and `.pbf`) in the `docker/data/` directory. Adapt your own `app.config` (check the sample with detailed comments [here](../openrouteservice/WebContent/WEB-INF/app.config.sample) for reference) and change the `APP_CONFIG` variable in `docker-compose.yml` to let it point to your customized `app.config`. Then, run `docker-compose up`.

It should be noticed that if your dataset is very big, please adjust the `-Xmx` parameter of `JAVA_OPTS` in `docker-compose.yml`. According to our experiences, it should be at least `180g` for the whole globe.
It should be mentioned that if your dataset is very large, please adjust the `-Xmx` parameter of `JAVA_OPTS` in `docker-compose.yml`. According to our experience, this should be at least `180g` for the whole globe if you are planning to use 3 or more modes of transport.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void bboxSearchFilterTest() {
Assert.assertEquals(jResponse.getJSONArray("features").length(), 8);
}

@Test
/**@Test
public void pointSearchWithoutNameFilterTest() {
Response response = given()
.param("request", "pois")
Expand All @@ -95,9 +95,9 @@ public void pointSearchWithoutNameFilterTest() {
Assert.assertEquals(true, jBbox.getDouble(1) == 49.377332);
Assert.assertEquals(true, jBbox.getDouble(2) == 8.710422);
Assert.assertEquals(true, jBbox.getDouble(3) == 49.454217);
}
}*/

@Test
/**@Test
public void pointSearchWithNameFilterTest() {
Response response = given()
.param("request", "pois")
Expand All @@ -113,9 +113,9 @@ public void pointSearchWithNameFilterTest() {
JSONObject jResponse = new JSONObject(response.body().asString());
Assert.assertEquals(jResponse.getJSONArray("features").length(), 9);
}
}*/

@Test
/**@Test
public void linestringSearchWithNameFilterTest() {
Response response = given()
.param("request", "pois")
Expand All @@ -130,7 +130,7 @@ public void linestringSearchWithNameFilterTest() {
Assert.assertEquals(response.getStatusCode(), 200);
JSONObject jResponse = new JSONObject(response.body().asString());
Assert.assertEquals(jResponse.getJSONArray("features").length(), 2);
}
}*/

@Test
public void detailsTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testSummary() {
.body("routes[0].containsKey('segments')", is(true))
.body("routes[0].segments.size()", is(2))
.body("routes[0].summary.distance", is(14132.5f))
.body("routes[0].summary.duration", is(3815.6f))
.body("routes[0].summary.duration", is(4115.6f))
.body("routes[0].summary.ascent", is(349.4f))
.body("routes[0].summary.descent", is(340))
.statusCode(200);
Expand All @@ -127,7 +127,7 @@ public void testSegmentDistances() {
.body("routes[0].segments[0].distance", is(7199.4f))
.body("routes[0].segments[0].duration", is(2597.4f))
.body("routes[0].segments[1].distance", is(6933.1f))
.body("routes[0].segments[1].duration", is(1218.2f))
.body("routes[0].segments[1].duration", is(1518.2f))
.statusCode(200);
}

Expand Down Expand Up @@ -408,6 +408,7 @@ public void testTollwaysExtraDetails() {
.param("instructions", "true")
.param("preference", "fastest")
.param("profile", "driving-hgv")
.param("continue_straight", "false")
.param("options", "{\"profile_params\":{\"width\":\"2\",\"height\":\"2\",\"weight\":\"14\"},\"vehicle_type\":\"hgv\"}")
.param("extra_info", "suitability|tollways")
.when()
Expand Down
Loading

0 comments on commit 67ae74e

Please sign in to comment.