Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/src/main/java/com/graphhopper/reader/osm/OSMReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ protected void addEdge(int fromIndex, int toIndex, PointList pointList, ReaderWa
throw new IllegalStateException("unaccepted way: " + way.getId());

IntsRef relationFlags = getRelFlagsMap(way.getId());
IntsRef edgeFlags = encodingManager.handleWayTags(way, acceptWay, relationFlags);
// ORS-GH MOD START additional parameters for from and to node ids
IntsRef edgeFlags = encodingManager.handleWayTags(fromIndex, toIndex, way, acceptWay, relationFlags);
// ORS-GH MOD END
if (edgeFlags.isEmpty())
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,13 @@ public void handleWay(ReaderWay way) {
// ORS-GH MOD START - way preprocessor might have changed the way tags, so we need to check the filter again
if (!wayFilter.test(way))
return;
try {
splitWayAtJunctionsAndEmptySections(segment, way);
} catch (Exception e) {
LOGGER.error("Error while processing way " + way.getId() + ": " + e.getMessage());
throw e;
}
// ORS-GH MOD END
splitWayAtJunctionsAndEmptySections(segment, way);
}

private void splitWayAtJunctionsAndEmptySections(List<SegmentNode> fullSegment, ReaderWay way) {
Expand Down
9 changes: 8 additions & 1 deletion core/src/main/java/com/graphhopper/routing/ev/Country.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,14 @@ public enum Country {
YEM("Yemen", "YE"),
ZAF("South Africa", "ZA"),
ZMB("Zambia", "ZM"),
ZWE("Zimbabwe", "ZW");
// ORS-GH MOD START additional ORS-specific territories
ZWE("Zimbabwe", "ZW"),
// the following values are for testing purposes only
XXA("Area 1", "XA"),
XXB("Area 2", "XB"),
XXC("Area 3", "XC"),
XXD("Area 4", "XD");
// ORS-GH MOD END

public static final String KEY = "country";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,17 @@ public void handleTurnRelationTags(OSMTurnRelation turnRelation, TurnCostParser.
* @param relationFlags The preprocessed relation flags is used to influence the way properties.
*/
public IntsRef handleWayTags(ReaderWay way, AcceptWay acceptWay, IntsRef relationFlags) {
// ORS-GH MOD START additional parameters to provide from/to node ids to tag parsers
return handleWayTags(-1, -1, way, acceptWay, relationFlags);
}

public IntsRef handleWayTags(int fromIndex, int toIndex, ReaderWay way, AcceptWay acceptWay, IntsRef relationFlags) {
IntsRef edgeFlags = createEdgeFlags();
// modified handler must be called before regular processing to ensure that "ors:country" tags set by the BorderParser are available for the downstream CountryParser
for (TagParser parser : edgeTagParsers) {
parser.handleWayTags(fromIndex, toIndex, edgeFlags, way, acceptWay.isFerry(), relationFlags);
}
// ORS-GH MOD END
for (TagParser parser : edgeTagParsers) {
parser.handleWayTags(edgeFlags, way, acceptWay.isFerry(), relationFlags);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public void createEncodedValues(EncodedValueLookup lookup, List<EncodedValue> re
@Override
public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, boolean ferry, IntsRef relationFlags) {
Country country = way.getTag("country", Country.MISSING);
// ORS-GH MOD START override with country information set by ORS
if (way.hasTag("ors:country"))
country = way.getTag("ors:country", Country.MISSING);
// ORS-GH MOD END
countryEnc.setEnum(false, edgeFlags, country);
return edgeFlags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public interface TagParser {
void createEncodedValues(EncodedValueLookup lookup, List<EncodedValue> registerNewEncodedValue);

IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, boolean ferry, IntsRef relationFlags);

// ORS-GH MOD START additional method to provide from/to node ids
default IntsRef handleWayTags(int from, int to, IntsRef edgeFlags, ReaderWay way, boolean ferry, IntsRef relationFlags) {
return edgeFlags;
}
// ORS-GH MOD END
}
Loading