Skip to content

Commit

Permalink
Merge pull request GIScience#679 from GIScience/bugfix/issue#678-ferr…
Browse files Browse the repository at this point in the history
…y_way_category

Fix way category assignment for ferry connections
  • Loading branch information
takb authored Mar 2, 2020
2 parents 096b78c + 1554a42 commit bd6f27e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed invalid JSON and GeoJSON when including elevation ([#640](https://github.com/GIScience/openrouteservice/issues/640))
- Added graph date for isochrones and matrix service and fixed the 0 output ([#648](https://github.com/GIScience/openrouteservice/issues/648))
- Fixed memory issue at graph building ([#659](https://github.com/GIScience/openrouteservice/issues/659))
- Improve way category assignment for ferry connections ([#678](https://github.com/GIScience/openrouteservice/issues/678))
### Changed
- Make Docker setup more flexible wrt customizations ([#627](https://github.com/GIScience/openrouteservice/issues/627))
- Updated GraphHopper to newer version (0.13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ public GraphExtension init(GraphHopper graphhopper) throws Exception {

public void processWay(ReaderWay way) {
wayType = 0;

boolean hasHighway = way.hasTag("highway");
boolean isFerryRoute = isFerryRoute(way);

java.util.Iterator<Entry<String, Object>> it = way.getProperties();
boolean isFerryRoute = way.hasTag("route", ferries);

while (it.hasNext()) {
Map.Entry<String, Object> pairs = it.next();
String key = pairs.getKey();
String value = pairs.getValue().toString();
if (hasHighway || isFerryRoute) {
java.util.Iterator<Entry<String, Object>> it = way.getProperties();

while (it.hasNext()) {
Map.Entry<String, Object> pairs = it.next();
String key = pairs.getKey();
String value = pairs.getValue().toString();

if (hasHighway || isFerryRoute) {
if (key.equals("highway")) {
if (value.equals("motorway") || value.equals("motorway_link")) {
wayType |= AvoidFeatureFlags.HIGHWAYS;
Expand All @@ -78,21 +78,6 @@ public void processWay(ReaderWay way) {
public void processEdge(ReaderWay way, EdgeIteratorState edge) {
storage.setEdgeValue(edge.getEdge(), wayType);
}

private boolean isFerryRoute(ReaderWay way) {
if (way.hasTag("route", ferries)) {
String motorcarTag = way.getTag("motorcar");
if (motorcarTag == null)
motorcarTag = way.getTag("motor_vehicle");

if (motorcarTag == null && !way.hasTag("foot") && !way.hasTag("bicycle") || "yes".equals(motorcarTag))
return true;

String bikeTag = way.getTag("bicycle");
return bikeTag == null && !way.hasTag("foot") || "yes".equals(bikeTag);
}
return false;
}

@Override
public String getName() {
Expand Down

0 comments on commit bd6f27e

Please sign in to comment.