Skip to content

Commit

Permalink
Merge pull request #378 from GIScience/release_4.7.2
Browse files Browse the repository at this point in the history
Release 4.7.2
  • Loading branch information
Timothy authored Dec 18, 2018
2 parents 4d37445 + f001d9b commit 6680107
Show file tree
Hide file tree
Showing 76 changed files with 1,986 additions and 4,883 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
### Deprecated

## [4.7.2] - 2018-12-10
### Added
- Added Unit Tests for RouteSearchParameters.class() (while fixing Issue #291)
- Added ability to return warning messages in the route response which can be used for showing info to a user when warning criteria have been met based on extended storages.
- Added a RoadAccessRestrictions extended storage as a warning extended storage for when a route goes of ways with access restrictions (Issue #342)
### Fixed
- If residential penalty reduces speed to <5, set it to 5
- Added a new ParameterValueException in RouteSearchParameters if the profile is driving-car and profile_params are set in the options (Issue #291)
- Fixed API Test to consider the new ParameterValueException (while fixing Issue #291)
- Improved range and resolution of values encoding dimension/weight road restrictions in order to properly resolve them when corresponding hgv parameters are set (fixes issue #263)
- Fixed empty BBox error if the route is located in the southern hemisphere (Issue #348)
- Take into account access restrictions specific to hgv subprofiles (fixes issue #235)
- Properly resolve all tolls, especially hgv-specific ones (fixes issue #358)
- Updated checks on pedestrian way filter for access restrictions
### Changed
- Allowed access for cars and hgvs on access=destination roads (Issue #342)
### Deprecated

## [4.7.1] - 2018-10-24
### Added
Added instructions to readme for installing without Docker (Issue #272)
Expand All @@ -18,6 +36,7 @@ Added area_units for isochrones API as units being misleading (Issue #272)
- Area calculation for isochrones using metric crs (Issue #130)
- Decreases maximum peed for bike-regular for more realistic reachability scores (Issue #325)
- Fixes self intersecting polygons when requesting population for isochrones (Issue #297)
- Changes center in isochrones response to snapped edge coordinate on graph (Issue #336)
- Enable HGV axleload restriction (Issue #262)
### Changed
- Changed app.config.sample for docker to consider split profiles (Issue #320)
Expand Down
17 changes: 17 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- If you have a question or improvement suggestion rather than an actual issue/bug, pls use our forum:-->

<!-- https://ask.openrouteservice.org/c/ors-->

#### Here's what I did
<!-- include request URLs, link to app.config or other relevant ifnormation -->

---
#### Here's what I got
<!-- we :heart: json outputs -->

---
#### Here's what I was expecting
<!-- try being as explicit as possible here so we know how to fix this issue -->

---
#### Here's what I think could be improved
1 change: 1 addition & 0 deletions openrouteservice-api-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target/
/.classpath
/.gitignore
/data/elevation/srtm_38_03.gh
5 changes: 4 additions & 1 deletion openrouteservice-api-tests/conf/app.config.test
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
graphs_root_path: "graphs",
elevation_provider: multi,
elevation_cache_clear: false,
elevation_cache_path: "cgiar_provider",
elevation_cache_path: "openrouteservice-api-tests/data/elevation",
instructions: true,
maximum_distance: 100000,
maximum_segment_distance_with_dynamic_weights: 50000,
Expand Down Expand Up @@ -209,6 +209,9 @@
boundaries: "openrouteservice-api-tests/data/borders/borders.geojson",
ids: "openrouteservice-api-tests/data/borders/ids.csv",
openborders: "openrouteservice-api-tests/data/borders/openborders.csv"
},
RoadAccessRestrictions: {
use_for_warnings: true
}
}
traffic: false
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ public void testPolygon() {
.body("features[0].geometry.coordinates[0].size()", is(33))
//.body("features[0].geometry.coordinates[0].size()", is(30))
.body("features[0].properties.center.size()", is(2))
.body("features[0].properties.center[0]", is(8.684177f))
.body("features[0].properties.center[1]", is(49.423034f))
//.body("bbox", hasItems(8.662622f, 49.40911f, 8.695994f, 49.440487f))
.body("bbox", hasItems(8.663811f, 49.409103f, 8.699429f, 49.43929f))
.body("features[0].type", is("Feature"))
Expand Down Expand Up @@ -270,7 +268,7 @@ public void testTwoDifferentTravellers_POST() {
.body("features.size()", is(5))
.body("features[0].type", is("Feature"))
.body("features[0].geometry.type", is("Polygon"))
.body("features[0].geometry.coordinates[0].size", is(23))
.body("features[0].geometry.coordinates[0].size", is(22))
.body("features[0].properties.containsKey('area')", is(true))
.body("features[1].type", is("Feature"))
.body("features[1].geometry.type", is("Polygon"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,4 +721,37 @@ public void expectUnknownUnits() {
.body("error.code", is(RoutingErrorCodes.INVALID_PARAMETER_VALUE))
.statusCode(400);
}

@Test
public void expectWarningsAndExtraInfo() {
given()
.param("coordinates", "8.675154,49.407727|8.675863,49.407162")
.param("preference", "shortest")
.param("profile", getParameter("carProfile"))
.when().log().all()
.get(getEndPointName())
.then().log().all()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].containsKey('warnings')", is(true))
.body("routes[0].containsKey('extras')", is(true))
.body("routes[0].extras.containsKey('roadaccessrestrictions')", is(true))
.statusCode(200);
}

@Test
public void expectSuppressedWarnings() {
given()
.param("coordinates", "8.675154,49.407727|8.675863,49.407162")
.param("preference", "shortest")
.param("profile", getParameter("carProfile"))
.param("suppress_warnings", "true")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].containsKey('warnings')", is(false))
.statusCode(200);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public void testGeoJsonExport(){
}

@Test
public void expectCarToRejectBikeParams() {
public void expectCarToRejectProfileParams() {

// options for cycling profiles
JSONObject options = new JSONObject();
Expand All @@ -428,7 +428,7 @@ public void expectCarToRejectBikeParams() {
.get(getEndPointName())
.then()
.assertThat()
.statusCode(200);
.statusCode(400);
}

@Test
Expand Down Expand Up @@ -787,10 +787,16 @@ public void testTollwaysExtraDetails() {
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].containsKey('extras')", is(true))
.body("routes[0].extras.tollways.values.size()", is(1))
.body("routes[0].extras.tollways.values.size()", is(3))
.body("routes[0].extras.tollways.values[0][0]", is(0))
.body("routes[0].extras.tollways.values[0][1]", is(86))
.body("routes[0].extras.tollways.values[0][1]", is(52))
.body("routes[0].extras.tollways.values[0][2]", is(0))
.body("routes[0].extras.tollways.values[1][0]", is(52))
.body("routes[0].extras.tollways.values[1][1]", is(66))
.body("routes[0].extras.tollways.values[1][2]", is(1))
.body("routes[0].extras.tollways.values[2][0]", is(66))
.body("routes[0].extras.tollways.values[2][1]", is(86))
.body("routes[0].extras.tollways.values[2][2]", is(0))
.statusCode(200);

checkExtraConsistency(response);
Expand Down Expand Up @@ -1077,6 +1083,41 @@ public void testHGVHeightRestriction() {
.statusCode(200);
}

@Test
public void testHGVAxleLoadRestriction() {
given()
.param("coordinates", "8.686849,49.406093|8.687525,49.405437")
.param("instructions", "false")
.param("preference", "shortest")
.param("profile", "driving-hgv")
.param("options", "{\"profile_params\":{\"restrictions\":{\"axleload\":\"12.9\"}},\"vehicle_type\":\"hgv\"}")
.param("units", "m")
.when().log().ifValidationFails()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(132.9f))
.body("routes[0].summary.duration", is(44.3f))
.statusCode(200);

given()
.param("coordinates", "8.686849,49.406093|8.687525,49.405437")
.param("instructions", "true")
.param("preference", "shortest")
.param("profile", "driving-hgv")
.param("options", "{\"profile_params\":{\"restrictions\":{\"axleload\":\"13.1\"}},\"vehicle_type\":\"hgv\"}")
.param("units", "m")
.when().log().ifValidationFails()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(364.3f))
.body("routes[0].summary.duration", is(92.7f))
.statusCode(200);
}

@Test
public void testCarDistanceAndDuration() {
// Generic test to ensure that the distance and duration dont get changed
Expand Down Expand Up @@ -1258,8 +1299,8 @@ public void testWheelchairInclineRestriction() {
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(594.4f))
.body("routes[0].summary.duration", is(493.8f))
.body("routes[0].summary.distance", is(591.6f))
.body("routes[0].summary.duration", is(498.7f))
.statusCode(200);

given()
Expand Down Expand Up @@ -1386,4 +1427,23 @@ public void testOsmIdExtras() {
.body("routes[0].extras.containsKey('osmId')", is(true))
.statusCode(200);
}

@Test
public void testAccessRestrictionsWarnings() {
given()
.param("coordinates", "8.675154,49.407727|8.675863,49.407162")
.param("preference", "shortest")
.param("profile", getParameter("carProfile"))
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].containsKey('warnings')", is(true))
.body("routes[0].warnings[0].code", is(1))
.body("routes[0].containsKey('extras')", is(true))
.body("routes[0].extras.containsKey('roadaccessrestrictions')", is(true))
.body("routes[0].extras.roadaccessrestrictions.values[1][2]", is(32))
.statusCode(200);
}
}
11 changes: 10 additions & 1 deletion openrouteservice/WebContent/WEB-INF/app.config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,16 @@
# boundaries: "...", - The path to a file containing geojson data representing the borders of countries
# ids: "...", - Path to a csv file containing a unique id for each country, its local name and its english name
# openborders: "..." - Path to a csv file contianing pairs of countries where the borders are open (i.e. Schengen borders)
# }
# },
# RoadAccessRestrictions are where roads are restricted to certain vehicles to certain circumstances.
# e.g. access=destination
RoadAccessRestrictions: {
# The use_for_warnings parameter tells the ors that this storage can be used for generating warning messages
# in the route response. For RoadAccessRestrictions, this means that whenever a route goes over a way
# which has some restrictions, a warning message will be delivered with the response and the roadaccessrestrictions
# extra info automatically added.
use_for_warnings: true
}
}
# Traffic feature is not ready for production.
traffic: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.graphhopper.storage.GraphHopperStorage;
import com.graphhopper.storage.SPTEntry;
import com.graphhopper.storage.index.QueryResult;
import com.graphhopper.util.shapes.GHPoint3D;
import com.vividsolutions.jts.geom.Coordinate;
import heigit.ors.common.TravelRangeType;
import heigit.ors.exceptions.InternalServerException;
Expand All @@ -41,6 +42,9 @@ public static AccessibilityMap findEdgeMap(RouteSearchContext searchCntx, Isochr

Coordinate loc = parameters.getLocation();
QueryResult res = gh.getLocationIndex().findClosest(loc.y, loc.x, searchCntx.getEdgeFilter());

GHPoint3D snappedPosition = res.getSnappedPoint();

int fromId = res.getClosestNode();

if (fromId == -1)
Expand Down Expand Up @@ -72,7 +76,6 @@ public static AccessibilityMap findEdgeMap(RouteSearchContext searchCntx, Isochr
dijkstraAlg.calcPath(fromId, Integer.MIN_VALUE);

IntObjectMap<SPTEntry> edgeMap = dijkstraAlg.getMap();

return new AccessibilityMap(edgeMap, dijkstraAlg.getCurrentEdge());
return new AccessibilityMap(edgeMap, dijkstraAlg.getCurrentEdge(), snappedPosition);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
*/
package heigit.ors.isochrones;

import java.util.ArrayList;
import java.util.List;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;

import java.util.ArrayList;
import java.util.List;

public class IsochroneMap {
private int _travellerId;
private Envelope _envelope;
private List<Isochrone> _isochrones;
private Coordinate _center;
public IsochroneMap(int travellerId, Coordinate center)

public IsochroneMap(int travellerId, Coordinate center)
{
_travellerId = travellerId;
_center = center;
Expand All @@ -48,7 +48,8 @@ public Coordinate getCenter()
return _center;
}

public Iterable<Isochrone> getIsochrones()

public Iterable<Isochrone> getIsochrones()
{
return _isochrones;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.graphhopper.storage.NodeAccess;
import com.graphhopper.storage.SPTEntry;
import com.graphhopper.util.*;
import com.graphhopper.util.shapes.GHPoint3D;
import com.vividsolutions.jts.geom.*;
import com.vividsolutions.jts.index.quadtree.Quadtree;
import heigit.ors.common.TravelRangeType;
Expand Down Expand Up @@ -73,9 +74,13 @@ public IsochroneMap compute(IsochroneSearchParameters parameters) throws Excepti
// 1. Find all graph edges for a given cost.
double maxSpeed = _searchContext.getEncoder().getMaxSpeed();

Coordinate loc = parameters.getLocation();
AccessibilityMap edgeMap = GraphEdgeMapFinder.findEdgeMap(_searchContext, parameters);

GHPoint3D point = edgeMap.getSnappedPosition();

Coordinate loc = (point == null) ? parameters.getLocation() : new Coordinate(point.lon, point.lat);

IsochroneMap isochroneMap = new IsochroneMap(parameters.getTravellerId(), loc);
AccessibilityMap edgeMap = GraphEdgeMapFinder.findEdgeMap(_searchContext, parameters);

if (LOGGER.isDebugEnabled())
{
Expand Down
Loading

0 comments on commit 6680107

Please sign in to comment.