Finding routes in the right direction

In my app, I index routes using the LineString geo shape.

I am trying to query for partial routes going in the right direction. More formally, I need to find documents with a route that intersects two radii in a particular correct order.

In this example, the route is from A to B, and I'm looking for a "sub-route" from X to Y. So the document should be returned if I search from X to Y, but not if I search from Y to X.

I have the intersection part working, but I am stuck on determining the route direction. From what I understand, the direction of my LineString is lost during indexing, since it is converted to a raster.

Any ideas for how to solve this would be appreciated.

1 Like