Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

move way filtering to phase 1

  • Loading branch information...
commit beb620448128d93764d2868c3700396c9b103a6b 1 parent d1852d2
@abyrd abyrd authored
View
3  ...etmap/src/main/java/org/opentripplanner/openstreetmap/impl/BinaryOpenStreetMapParser.java
@@ -78,9 +78,10 @@ protected void parseNodes(List<Osmformat.Node> nodes) {
tmp.setLon(parseLon(i.getLon()));
for (int j = 0; j < i.getKeysCount(); j++) {
- OSMTag tag = new OSMTag();
String key = getStringById(i.getKeys(j)).intern();
+ // if _handler.retain_tag(key) // TODO: filter tags
String value = getStringById(i.getVals(j)).intern();
+ OSMTag tag = new OSMTag();
tag.setK(key);
tag.setV(value);
tmp.addTag(tag);
View
34 ...c/main/java/org/opentripplanner/graph_builder/impl/osm/OpenStreetMapGraphBuilderImpl.java
@@ -653,8 +653,18 @@ public void addNode(OSMNode node) {
}
public void addWay(OSMWay way) {
+ /* only add ways once */
if (_ways.containsKey(way.getId()))
return;
+ /* filter out ways that are not relevant for routing */
+ if (!(way.hasTag("highway") || way.isTag("railway", "platform")))
+ return;
+ if (way.isTag("highway", "conveyer") || way.isTag("highway", "proposed"))
+ return;
+ if (way.isTag("area", "yes"))
+ // routing on areas is not yet supported. areas can cause problems with stop linking.
+ // (24th & Mission BART plaza is both highway=pedestrian and area=yes)
+ return;
_ways.put(way.getId(), way);
@@ -687,24 +697,20 @@ public void secondPhase() {
// the way purging keeps the needed way around.
// Multipolygons may be processed more than once, which may be needed since
// some member might be in different files for the same multipolygon.
+
+ // NOTE (AMB): this purging phase may not be necessary if highway tags are not
+ // copied over from multipolygon relations. Perhaps we can get by with
+ // only 2 steps -- ways+relations, followed by used nodes.
+ // Ways can be tag-filtered in phase 1.
+
processMultipolygons();
for (Iterator<OSMWay> it = _ways.values().iterator(); it.hasNext();) {
OSMWay way = it.next();
- if (!(way.hasTag("highway") || way.isTag("railway", "platform"))) {
- it.remove();
- } else if (way.isTag("highway", "conveyer") || way.isTag("highway", "proposed")) {
- it.remove();
- } else if (way.isTag("area", "yes")) {
- // routing on areas is not yet supported. areas can cause problems with stop linking.
- // (24th & Mission BART plaza is both highway=pedestrian and area=yes)
- it.remove();
- } else {
- // Since the way is kept, update nodes-with-neighbors
- List<Long> nodes = way.getNodeRefs();
- if (nodes.size() > 1) {
- _nodesWithNeighbors.addAll(nodes);
- }
+ // Since the way is kept, update nodes-with-neighbors
+ List<Long> nodes = way.getNodeRefs();
+ if (nodes.size() > 1) {
+ _nodesWithNeighbors.addAll(nodes);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.