Skip to content

Commit

Permalink
Merge pull request #3 from GIScience/nodeTagsToWayTags
Browse files Browse the repository at this point in the history
Fix memory usage
  • Loading branch information
TimMcCauley authored Dec 22, 2017
2 parents b032573 + 800460e commit 7f952d2
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ public class OSMReader implements DataReader {
// Modification by Maxim Rylov
private boolean calcDistance3D = true;

public static final String[] HGV_VALUES = new String[] { "maxheight", "maxweight", "maxweight:hgv", "maxwidth", "maxlength", "maxlength:hgv", "maxaxleload" };
public static final Set<String> hgv_tags = new HashSet<>(Arrays.asList(HGV_VALUES));


public OSMReader(GraphHopperStorage ghStorage) {
this.ghStorage = ghStorage;
this.graph = ghStorage;
Expand Down Expand Up @@ -609,7 +613,17 @@ boolean addNode(ReaderNode node) {
addTowerNode(node.getId(), lat, lon, ele);
} else if (nodeType == PILLAR_NODE) {
pillarInfo.setNode(nextPillarId, lat, lon, ele);
osmNodeIdToReaderNodeMap.put(node.getId(), node.getTags());
java.util.Iterator<Entry<String, Object>> it = node.getTags().entrySet().iterator();
Map<String, Object> temp = new HashMap<>();

while (it.hasNext()) {
Map.Entry<String, Object> pairs = it.next();
String key = pairs.getKey();
if(!hgv_tags.contains(key))
continue;
temp.put(key, pairs.getValue());
}
if(!temp.isEmpty()) osmNodeIdToReaderNodeMap.put(node.getId(), temp);
getNodeMap().put(node.getId(), nextPillarId + 3);
nextPillarId++;
}
Expand Down

0 comments on commit 7f952d2

Please sign in to comment.