restrictions) {
+ String [] empty = {};
+ for (String str : restrictions) {
+ if (hasTag(str))
+ return getTagValues(str);
+ }
+ return empty;
+ }
+ // ORS-GH MOD END
+
public void removeTag(String name) {
properties.remove(name);
}
diff --git a/core/src/main/java/com/graphhopper/reader/ReaderNode.java b/core/src/main/java/com/graphhopper/reader/ReaderNode.java
index 65930ef59d0..46106aff418 100644
--- a/core/src/main/java/com/graphhopper/reader/ReaderNode.java
+++ b/core/src/main/java/com/graphhopper/reader/ReaderNode.java
@@ -41,6 +41,30 @@ public double getLon() {
return lon;
}
+ public double getEle() {
+ Object ele = this.getTags().get("ele");
+ if ( ele == null)
+ return Double.NaN;
+ String value = "";
+ try {
+ value = ((String)ele).trim();
+ } catch (ClassCastException e) {
+ return Double.NaN;
+ }
+ try {
+ return Double.parseDouble(value);
+ } catch (NumberFormatException e) {
+ try {
+ if (value.contains(".")) {
+ return Double.parseDouble(value.replace(",", ""));
+ }
+ return Double.parseDouble(value.replace(",", "."));
+ } catch (NumberFormatException e2) {
+ return Double.NaN;
+ }
+ }
+ }
+
@Override
public String toString() {
StringBuilder txt = new StringBuilder();
diff --git a/core/src/main/java/com/graphhopper/reader/ReaderWay.java b/core/src/main/java/com/graphhopper/reader/ReaderWay.java
index 9cb15a3d5ab..67c30477843 100644
--- a/core/src/main/java/com/graphhopper/reader/ReaderWay.java
+++ b/core/src/main/java/com/graphhopper/reader/ReaderWay.java
@@ -26,11 +26,26 @@
* @author Nop
*/
public class ReaderWay extends ReaderElement {
- protected final LongArrayList nodes = new LongArrayList(5);
+ // ORS-GH MOD START
+ // TODO ORS (minor): provide a reason for this change (see also PbfBlobDecoder)
+ // ORG CODE
+ /*protected final LongArrayList nodes = new LongArrayList(5);
+ public ReaderWay(long id) {
+ super(id, WAY);
+ }*/
+ // ORG CODE END
+
+ protected final LongArrayList nodes;
public ReaderWay(long id) {
+ this(id, 5);
+ }
+
+ public ReaderWay(long id, int size) {
super(id, WAY);
+ nodes = new LongArrayList(size);
}
+ // ORS-GH MOD END
public LongArrayList getNodes() {
return nodes;
diff --git a/core/src/main/java/com/graphhopper/reader/osm/OSMInputFile.java b/core/src/main/java/com/graphhopper/reader/osm/OSMInputFile.java
index 394ede97dc0..8d98c4589a4 100644
--- a/core/src/main/java/com/graphhopper/reader/osm/OSMInputFile.java
+++ b/core/src/main/java/com/graphhopper/reader/osm/OSMInputFile.java
@@ -199,8 +199,14 @@ private ReaderElement getNextXML() throws XMLStreamException {
case 'n':
// note vs. node
if ("node".equals(name)) {
- id = Long.parseLong(idStr);
- return OSMXMLHelper.createNode(id, xmlParser);
+ // ORS-GH MOD START Modification by Maxim Rylov: Added additional check to cope with corrupted files.
+ if (xmlParser.getAttributeValue(null, "lat") != null) {
+ // ORS-GH MOD END
+ id = Long.parseLong(idStr);
+ return OSMXMLHelper.createNode(id, xmlParser);
+ // ORS-GH MOD START
+ }
+ // ORS-GH MOD END
}
break;
diff --git a/core/src/main/java/com/graphhopper/reader/osm/OSMReader.java b/core/src/main/java/com/graphhopper/reader/osm/OSMReader.java
index 2f551008c9d..30a6ecd1c4d 100644
--- a/core/src/main/java/com/graphhopper/reader/osm/OSMReader.java
+++ b/core/src/main/java/com/graphhopper/reader/osm/OSMReader.java
@@ -28,9 +28,11 @@
import com.graphhopper.routing.ev.Country;
import com.graphhopper.routing.util.AreaIndex;
import com.graphhopper.routing.util.CustomArea;
+import com.graphhopper.routing.util.AbstractFlagEncoder;
import com.graphhopper.routing.util.EncodingManager;
import com.graphhopper.routing.util.countryrules.CountryRule;
import com.graphhopper.routing.util.countryrules.CountryRuleFactory;
+import com.graphhopper.routing.util.FlagEncoder;
import com.graphhopper.routing.util.parsers.TurnCostParser;
import com.graphhopper.storage.*;
import com.graphhopper.util.*;
@@ -69,6 +71,7 @@
*
*
* @author Peter Karich
+ * @author Andrzej Oles
*/
public class OSMReader implements TurnCostParser.ExternalInternalMap {
protected static final int EMPTY_NODE = -1;
@@ -118,6 +121,15 @@ public class OSMReader implements TurnCostParser.ExternalInternalMap {
private final IntsRef tempRelFlags;
private final TurnCostStorage tcs;
+ // ORS-GH MOD - Add variable for identifying which tags from nodes should be stored on their containing ways
+ private Set nodeTagsToStore = new HashSet<>();
+ // ORS-GH MOD - Add variable for storing tags obtained from nodes
+ private GHLongObjectHashMap