Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public transport stops #76

Open
vvoovv opened this issue Dec 14, 2023 · 11 comments
Open

Public transport stops #76

vvoovv opened this issue Dec 14, 2023 · 11 comments

Comments

@vvoovv
Copy link
Member

vvoovv commented Dec 14, 2023

image

A bus stop can have a special marking on the roadway. There can be a bus bay as in the image above.

Bus stops are typically represented with nodes. They also can represented with open or closed OSM-ways. In the latter case the bus stops are mapped with areas.

The tags highway=bus_stop (legacy) AND/OR public_transport=platform are used to map a bus stop.

@vvoovv
Copy link
Member Author

vvoovv commented Dec 14, 2023

The problem is to find to which way-segment a platform is attached. Once that way-segment is found, the node of the platform is projected on the way-segment. The related Section may be split at the projection point, then the resulting Sections are trimmed to insert a PtStop.

image

@vvoovv
Copy link
Member Author

vvoovv commented Dec 14, 2023

Below is a possible solution to the above problem.

Vertices of all Sections can be inserted into a KD Tree. If the length of a way-segment exceeds some threshold, then additional vertices on the way-segment are inserted to the KD Tree.

The following Python tuple for each node in the KD Tree is inserted into a special Python list:
(
Section,
index in the original Section's centerline,
a Boolean indicating if it's original vertex in the centerline or an additional vertex between the original ones
)

The KD Tree is queried for each platform. The result of the query is the index in the above Python list. Then it's easy to find the projection of the position of the platform on the Section.

@polarkernel
Copy link
Collaborator

Below is a possible solution to the above problem.

Another possible solution, based on already existing computations.

To find parallel way-sections for clusters (bundles), a StaticSpatialIndex is constructed. It uses bounding boxes around the way-sections and is able to find intersecting boxes very quickly. Such a box around the vertices of a PtStop platform, increased by a search distance, could be used as a search object to find near way-sections in this index.

The PolyLine class of the centerline of a way-section already implements the method orthoProj(), which projects a point onto the polyline. This would easily allow the projection mentioned above.

@vvoovv
Copy link
Member Author

vvoovv commented Dec 20, 2023

Another possible solution, based on already existing computations.

I am going to try both methods. An obvious advantage of the KD tree method is that it provides the closest way-section directly without choosing among a number of way-sections.

First, I'll prepare a list of pt-stops in the code.

@vvoovv
Copy link
Member Author

vvoovv commented Dec 21, 2023

How can one set the parameter location for the class PtStop?

@polarkernel
Copy link
Collaborator

How can one set the parameter location for the class PtStop?

stop = PtStop(location)

where location is the converted geographical location of the OSM node, for example from

  "type": "node",
  "id": 365726729,
  "lat": 52.5089330,
  "lon": 13.4245368,
  "tags": {
    "bench": "no",
    "bin": "yes",
    "bus": "yes",
    "highway": "bus_stop",
    "lit": "yes",
    "name": "Köpenicker Straße/Adalbertstraße",
    "public_transport": "platform",
    "shelter": "no",
    "tactile_paving": "no"
  }

location is expected to be an instance of mathutils.Vector.

At least, this was what I thought, or do I misunderstand your question? The usage of a location is also the reason why I didn't consider PtStop to be a line object, location is used in the way-map as a key for a node.

@vvoovv
Copy link
Member Author

vvoovv commented Dec 21, 2023

At least, this was what I thought, or do I misunderstand your question?

I just wanted to know how the attribute location is calculated. The coordinates of the node in Blender's system of reference are used in the case of a node. If it's a an area or a polyline, then its center is used. Right?

@vvoovv
Copy link
Member Author

vvoovv commented Dec 21, 2023

Does it matter if the value of the attribute location will be on the sidewalk rather than on the roadway?

@polarkernel
Copy link
Collaborator

If it's a an area or a polyline, then its center is used. Right?

Yes. For example, for an Intersection, the location is first the position (in Blender's system) of the node where two OSM way-sections intersect. To start, we have nothing else. Later, a polygon is constructed that describes the area of the intersection with a new attribute area. From then on, location is used only as a key to retrieve this object.

Does it matter if the value of the attribute location will be on the sidewalk rather than on the roadway?

Well, this is the point that is still unclear to me. Is PtStop an element of the way-map (a graph, that describes the road network) or is it an element (part of, attribute, ...) of a Section or a Roadway? An attribute location is only needed for the first case (PtStop then splits the Section or Roadway).

I assume, that, similar to the Intersection, some construction (maybe also of an area) has to take place, so that the PtStop can be rendered correctly. In this case, its exact location is not important, the attribute will only be used as a key. I think the solution that best allows rendering should be used.

@vvoovv
Copy link
Member Author

vvoovv commented Dec 21, 2023

Is PtStop an element of the way-map (a graph, that describes the road network) or is it an element (part of, attribute, ...) of a Section or a Roadway?

It's a special case of a Section. I am going to create instances of PtStop just after parsing of an OSM file. The attribute location won't be set for now.

@vvoovv
Copy link
Member Author

vvoovv commented Dec 21, 2023

Pt-platforms are currently stored in PtStopManager. How to find the nearest way-sections using the spatial index?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants