# Check if vehicle is driving on water

**URL:** <https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862>\
**Category:** Kibana\
**Created:** [October 30, 2019, 12:50pm UTC](https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862 "2019-10-30T12:50:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AstroSlazak](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AstroSlazak](https://discuss.elastic.co/u/AstroSlazak)\
**Post date:** [October 30, 2019, 12:50pm UTC](https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862/1 "2019-10-30T12:50:00Z")

</div>

Hi,

I have map with vehicles, some times i have an error with position data and i want to check if some of vehicle is not driving on water, if yes get an alert. How can i do it ?

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [October 31, 2019, 12:38am UTC](https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862/2 "2019-10-31T00:38:16Z")

</div>

That is a very interesting case. This should be possible with a [geo\_shape query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html#_pre_indexed_shape).

Here's how I would do this.

1. Index your vehicle position data as a [**geo\_shape** field](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-shape.html).
2. In a separate index, add a geo\_shape polygon for land (not water) areas.
3. Create a [Watch with a Search input](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/input-search.html) using a [geo\_shape query pre-indexed shape](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html#_pre_indexed_shape) to find positions that are within the land geo\_shape polygon.
4. Add a [condition](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/input-search.html#_applying_conditions) to the Watch to alert when the results are greater than zero.
5. Add a [trigger](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/trigger-schedule.html) and an [email action](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/actions-email.html) to the Watch.

---

<div class="post-metadata">

**Author:** ![AstroSlazak](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AstroSlazak](https://discuss.elastic.co/u/AstroSlazak)\
**Post date:** [October 31, 2019, 8:35am UTC](https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862/3 "2019-10-31T08:35:23Z")

</div>

Need i map my vehicle position to geo\_shape ? I have maped it to geo\_point and if it is not necessery i don't want to change it.

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [October 31, 2019, 7:13pm UTC](https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862/4 "2019-10-31T19:13:25Z")

</div>

Yes, but only if you want to use a pre-indexed shape for the query. the [geo\_polygon query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-query.html), which works with geo\_points, does not yet support pre-indexed shapes. There is a feature request for this here. [https://github.com/elastic/elasticsearch/issues/46730](https://github.com/elastic/elasticsearch/issues/46730)

I think it may be possible to use the geo\_polygon query with your geo\_points if you pass a static polygon in the query. But your query may be very large if you have a polygon with many coordinates.

---

<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:** [November 28, 2019, 7:13pm UTC](https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862/5 "2019-11-28T19:13:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
