# Finding routes in the right direction

**URL:** <https://discuss.elastic.co/t/finding-routes-in-the-right-direction/52698>\
**Category:** Elasticsearch\
**Created:** [June 14, 2016, 7:56am UTC](https://discuss.elastic.co/t/finding-routes-in-the-right-direction/52698 "2016-06-14T07:56:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chopmo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chopmo/32/10301_2.png) [@chopmo](https://discuss.elastic.co/u/chopmo)\
**Post date:** [June 14, 2016, 7:56am UTC](https://discuss.elastic.co/t/finding-routes-in-the-right-direction/52698/1 "2016-06-14T07:56:21Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/1150391a6879084ed872430d9bc6651117bfa6db.png)

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:44pm UTC](https://discuss.elastic.co/t/finding-routes-in-the-right-direction/52698/2 "2017-07-05T22:44:04Z")

</div>


