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

lines in 3D use case #175

Open
harmjonker opened this issue Sep 4, 2024 · 1 comment
Open

lines in 3D use case #175

harmjonker opened this issue Sep 4, 2024 · 1 comment

Comments

@harmjonker
Copy link

I have the use case of searching nearest line segments based on an input location (from GPS), but it includes the time dimension too. It is for finding train paths based on location, time combination.
So, a train goes from A to B at 10:00h but also at 11:00h. Given a gps location along the route between A and B at a given time, which train journey is this gps coordinate related to, the 10:00h one or the 11:00h.
I wanted to model this with line segments in three dimensions, so from (Ax,Ay,10:00) to (Bx,By,10:45) and (Ax,Ay,11:00) to (Bx,By,11:45) are the two lines representing the two trains.
Can I support this out of the box with the rstar code or would I need to add an new data type to model the 3 dimensional point?
I would also need to add an attribute to each point for reference to metadata about the station.

@rmanoka
Copy link
Contributor

rmanoka commented Sep 5, 2024

RTree is useful make spatial queries. IIUC, in your formulation, query is GPS 2-d point + time encoded as 3-d point, and you want to locate the closest train-run-segment, which is a 3-d line.

For this, you could use the Line object represented in the tree, and then use envelope intersection to query and obtain all lines that cross within the 3-d BOX with corners at (x +- dx, y +- dy, z +- dz).

However, the above function may give some false positives, because it constructs one envelope for one line. If this is an issue, then based on what (dx, dy, dz) work for you; break up the input line-segments into smaller ones, in which case the envelopes will be smaller, and false-positives would reduce.

For storing metadata, use GeomWithData

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