# Error with geo\_shape polygon query with points on the dateline

**URL:** <https://discuss.elastic.co/t/error-with-geo-shape-polygon-query-with-points-on-the-dateline/265401>\
**Category:** Elasticsearch\
**Created:** [February 24, 2021, 7:26pm UTC](https://discuss.elastic.co/t/error-with-geo-shape-polygon-query-with-points-on-the-dateline/265401 "2021-02-24T19:26:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robqliu](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@robqliu](https://discuss.elastic.co/u/robqliu)\
**Post date:** [February 24, 2021, 7:26pm UTC](https://discuss.elastic.co/t/error-with-geo-shape-polygon-query-with-points-on-the-dateline/265401/1 "2021-02-24T19:26:28Z")

</div>

I have a polygon in a test that appears to be processed incorrectly and it ends up triggering an `InvalidShapeException`. The points are:

```auto
-175, 20
180, 15
-177, 10
180, 5
-175, 0
-175, 20

```

(minor update: This also fails if you use -180 instead of 180, if that makes this easier to visualize. It's a sideways isosceles trapezoid with an indent on the shorter side)

The `MultiPolygon` that fails has this `toString()`:

```auto
MULTIPOLYGON (((-180 5, -180 15, -177 10, -180 5)), ((-180 15, -180 5, -175 0, -175 20, -180 15)))

```

And the validation error is this:

```auto
Self-intersection at or near point (-180.0, 5.0, NaN)

```

So you can see it decided to split out a concave triangle with the two points that touch the dateline. I tried tracing this but I wasn't really able to understand why. Regardless, this _seems_ to be a "valid" geometry that ends up being invalid due to query processing.

Right now my planned workaround is to nudge points on the dateline slightly, but I don't think that's guaranteed to be correct, so I'm curious about other workarounds/fixes.

---

<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:** [March 24, 2021, 7:27pm UTC](https://discuss.elastic.co/t/error-with-geo-shape-polygon-query-with-points-on-the-dateline/265401/2 "2021-03-24T19:27:23Z")

</div>

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