-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
This is the feature that is present in the "public transport" addon, and would be really, REALLY useful if we could have it support the PTv2 schema. Currently, the "public transport" addon needs "forward" and "backward" roles to tell whether a stop is on the left side or right side of the road. If this feature could be implemented into pt_assistant, it could really speed up the mapping of public transport routes.
Here is the java file which (I think) contains the "suggest stops" code:
Here seems to be some code I salvaged from that file that actually does the "suggesting stops":
else if ("routePattern.metaSuggestStops".equals(event.getActionCommand())) {
// Prepare Segments: The segments of all usable ways are arranged in a linear
// list such that a coor can directly be checked concerning position and offset
Vector<StopReference> srm = new Vector<>();
// Determine for each member its position on the itinerary: position means here the
// point on the itinerary that has minimal distance to the coor
mainDataSet = MainApplication.getLayerManager().getEditDataSet();
if (mainDataSet != null) {
String stopKey = "";
String stopValue = "";
if ("bus".equals(currentRoute.get("route"))) {
stopKey = "highway";
stopValue = "bus_stop";
} else if ("trolleybus".equals(currentRoute.get("route"))) {
stopKey = "highway";
stopValue = "bus_stop";
} else if ("tram".equals(currentRoute.get("route"))) {
stopKey = "railway";
stopValue = "tram_stop";
} else if ("light_rail".equals(currentRoute.get("route"))) {
stopKey = "railway";
stopValue = "station";
} else if ("subway".equals(currentRoute.get("route"))) {
stopKey = "railway";
stopValue = "station";
} else if ("rail".equals(currentRoute.get("route"))) {
stopKey = "railway";
stopValue = "station";
}
Collection<Node> nodeCollection = mainDataSet.getNodes();
Iterator<Node> nodeIter = nodeCollection.iterator();
while (nodeIter.hasNext()) {
Node currentNode = nodeIter.next();
if (!currentNode.isUsable())
continue;
if (stopValue.equals(currentNode.get(stopKey))) {
StopReference sr = detectMinDistance(currentNode, segmentMetrics,
cbRight.isSelected(), cbLeft.isSelected());
if ((sr != null)
&& (sr.distance < Double.parseDouble(tfSuggestStopsLimit.getText())
* 9.0 / 1000000.0))
srm.addElement(sr);
}
}
}See: https://lists.openstreetmap.org/pipermail/josm-dev/2020-November/008346.html
Metadata
Metadata
Assignees
Labels
No labels