# Maps : how to join locations with polygons and counting

**URL:** <https://discuss.elastic.co/t/maps-how-to-join-locations-with-polygons-and-counting/223362>\
**Category:** Kibana\
**Tags:** maps\
**Created:** [March 12, 2020, 3:01pm UTC](https://discuss.elastic.co/t/maps-how-to-join-locations-with-polygons-and-counting/223362 "2020-03-12T15:01:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nonow53](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nonow53/32/81767_2.png) [@Nonow53](https://discuss.elastic.co/u/Nonow53)\
**Post date:** [March 12, 2020, 3:01pm UTC](https://discuss.elastic.co/t/maps-how-to-join-locations-with-polygons-and-counting/223362/1 "2020-03-12T15:01:16Z")

</div>

Hi,

I have a lot of boat positions in a layer.  
I imported a GeoJSON map describing different zones (polygons) in an other layer.  
I want to do statistics by zone. For example, display the number of boats by zone.  
I did not succeed in to do it.  
The only way to do a relation between two layers is to have a share key between the positions index and the geojson map index (as in the tutorial with countries and apache logs).

Is it possible in Elastic Maps 7.6 ? If no, is it in the road map ?

Thanks for your help.

Regards  
Arnaud

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [March 12, 2020, 3:24pm UTC](https://discuss.elastic.co/t/maps-how-to-join-locations-with-polygons-and-counting/223362/2 "2020-03-12T15:24:32Z")

</div>

Hi Arnaud

You can't do this at query time at this moment, but you can assign zone identifiers to each position at ingest time using a pipeline and the enrich processor, check [this example](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-match-enrich-policy-type.html) that fits exactly the Point in Polygon use case.

It's being discussed to make this workflow actionable from Elastic Maps, but at this moment you'll need to reindex manually.

Additionally, you may find a similar workflow but more focused in real time alerting on [this other post](https://discuss.elastic.co/t/check-if-vehicle-is-driving-on-water/205862).

Hope it helps.

---

<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:** [April 9, 2020, 3:24pm UTC](https://discuss.elastic.co/t/maps-how-to-join-locations-with-polygons-and-counting/223362/3 "2020-04-09T15:24:34Z")

</div>

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