# Geo bounding box search across anti-meridian

**URL:** <https://discuss.elastic.co/t/geo-bounding-box-search-across-anti-meridian/3316>\
**Category:** Elasticsearch\
**Created:** [September 9, 2010, 4:15pm UTC](https://discuss.elastic.co/t/geo-bounding-box-search-across-anti-meridian/3316 "2010-09-09T16:15:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei/32/2856_2.png) [@Andrei](https://discuss.elastic.co/u/Andrei)\
**Post date:** [September 9, 2010, 4:15pm UTC](https://discuss.elastic.co/t/geo-bounding-box-search-across-anti-meridian/3316/1 "2010-09-09T16:15:57Z")

</div>

I'm testing the new geo-search in 0.10 and ran into an issue. It seems  
that ES does not like bounding boxes that extend across the  
antimeridian (180° meridian). If I specify a box with top left corner  
to the left of the meridian, and bottom right on the right, it treats  
it as if the box wrapped around the wrong (long) way around the Earth.

Example:

curl -XPUT '[http://localhost:9200/bug/](http://localhost:9200/bug/)' -d'{ index:  
{ number\_of\_shards: 1, number\_of\_replicas: 0 } }'  
curl -XPUT '[http://localhost:9200/bug/test/\_mapping](http://localhost:9200/bug/test/_mapping)' -d '{  
"test" : {  
"properties" : {  
"user" : {"type" : "string", "index" : "not\_analyzed"},  
"title" : {"type" : "string", "boost" : 2.0},  
"notes" : {"type" : "string"},  
"tags" : {"type" : "string", "index\_name" : "tag"},  
"created" : {"type" : "date", "format" : "YYYY-MM-DD  
HH:mm:ss"},  
"geo" : {"type" : "geo\_point"},  
"privacy" : {"type" : "integer"}  
}  
}  
}'

curl -XPUT "[http://localhost:9200/bug/test/1](http://localhost:9200/bug/test/1)" -d'{"tags":  
["geotagged", "w", "incendio", "puglia", "vacanze", "peschici",  
"estate2007", "leconseguenzedellincendio"], "notes": "", "created":  
"2007-08-22 02:52:15", "privacy": 1000, "user": "liberodicrederci",  
"title": "incendio peschici", "geo": {"lat": 21.5, "lon": -158.2}}'

curl -XPUT "[http://localhost:9200/bug/test/2](http://localhost:9200/bug/test/2)" -d'{"tags":  
["geotagged", "w", "incendio", "puglia", "vacanze", "peschici",  
"estate2007", "leconseguenzedellincendio"], "notes": "", "created":  
"2007-08-22 02:52:15", "privacy": 1000, "user": "liberodicrederci",  
"title": "incendio peschici", "geo": {"lat": 29.5, "lon": -108.6}}'

curl -XPOST "[http://localhost:9200/bug/test/\_search?pretty=true](http://localhost:9200/bug/test/_search?pretty=true)" -d'  
{  
"query": {  
"constant\_score": {  
"filter": {  
"geo\_bounding\_box": {  
"geo": {  
"top\_left" : {  
"lat" : 32.5,  
"lon" : 169.1  
},  
"bottom\_right" : {  
"lat" : 5.8,  
"lon" : -140.6  
}  
}  
}  
}  
}  
}  
}'

This should return document 1, but instead returns document 2.

-Andrei

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [September 9, 2010, 4:25pm UTC](https://discuss.elastic.co/t/geo-bounding-box-search-across-anti-meridian/3316/2 "2010-09-09T16:25:09Z")

</div>

On Thu, 2010-09-09 at 09:15 -0700, Andrei wrote:

> I'm testing the new geo-search in 0.10 and ran into an issue. It seems  
> that ES does not like bounding boxes that extend across the  
> antimeridian (180Â° meridian). If I specify a box with top left corner  
> to the left of the meridian, and bottom right on the right, it treats  
> it as if the box wrapped around the wrong (long) way around the Earth.

I think that's what is known as an edge case 🙂

Would you mind opening an issue with a curl recreation?

> **[Issues · elastic/elasticsearch](https://github.com/elastic/elasticsearch/issues)**
>
> Free and Open, Distributed, RESTful Search Engine. Contribute to elastic/elasticsearch development by creating an account on GitHub.

thanks

Clint

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei/32/2856_2.png) [@Andrei](https://discuss.elastic.co/u/Andrei)\
**Post date:** [September 9, 2010, 4:36pm UTC](https://discuss.elastic.co/t/geo-bounding-box-search-across-anti-meridian/3316/3 "2010-09-09T16:36:42Z")

</div>

Yeah, falling off the end of the world.

Open:

> <https://github.com/elastic/elasticsearch/issues/363>
>
> It seems that ES does not like bounding boxes that extend across the 
> antimeridi…an (180° meridian). If I specify a box with top left corner 
> to the left of the meridian, and bottom right on the right, it treats 
> it as if the box wrapped around the wrong (long) way around the Earth.
> 
> \`\`\`
> curl -XPUT 'http://localhost:9200/bug/' -d'{ index: { number\_of\_shards: 1, number\_of\_replicas: 0 } }'
> curl -XPUT 'http://localhost:9200/bug/test/\_mapping' -d '{
> "test" : {
> "properties" : {
> "user" : {"type" : "string", "index" : "not\_analyzed"},
> "title" : {"type" : "string", "boost" : 2.0},
> "notes" : {"type" : "string"},
> "tags" : {"type" : "string", "index\_name" : "tag"},
> "created" : {"type" : "date", "format" : "YYYY-MM-DD HH:mm:ss"},
> "geo" : {"type" : "geo\_point"},
> "privacy" : {"type" : "integer"}
> }
> }
> }'
> 
> curl -XPUT "http://localhost:9200/bug/test/1" -d'{"tags": \["geotagged", "w", "incendio", "puglia", "vacanze", "peschici", "estate2007", "leconseguenzedellincendio"\], "notes": "", "created": "2007-08-22 02:52:15", "privacy": 1000, "user": "liberodicrederci", "title": "incendio peschici", "geo": {"lat": 21.5, "lon": -158.2}}'
> curl -XPUT "http://localhost:9200/bug/test/2" -d'{"tags": \["geotagged", "w", "incendio", "puglia", "vacanze", "peschici", "estate2007", "leconseguenzedellincendio"\], "notes": "", "created": "2007-08-22 02:52:15", "privacy": 1000, "user": "liberodicrederci", "title": "incendio peschici", "geo": {"lat": 29.5, "lon": -108.6}}'
> 
> curl -XPOST "http://localhost:9200/bug/test/\_search?pretty=true" -d'
> {
> "query": {
> "constant\_score": {
> "filter": {
> "geo\_bounding\_box": {
> "geo": {
> "top\_left" : {
> "lat" : 32.5,
> "lon" : 169.1
> },
> "bottom\_right" : {
> "lat" : 5.8,
> "lon" : -140.6
> }
> }
> }
> }
> }
> }
> }'
> \`\`\`

-Andrei

On Sep 9, 9:25 am, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> I think that's what is known as an edge case 🙂
> 
> Would you mind opening an issue with a curl recreation?
> 
> [Issues · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues)
> 
> thanks
> 
> Clint

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 10, 2010, 1:05pm UTC](https://discuss.elastic.co/t/geo-bounding-box-search-across-anti-meridian/3316/4 "2010-09-10T13:05:04Z")

</div>

Hi,

Yea, it did not handle it correctly. I have just pushed a fix to it.

-shay.banon

On Thu, Sep 9, 2010 at 7:36 PM, Andrei [andrei@zmievski.org](mailto:andrei@zmievski.org) wrote:

> Yeah, falling off the end of the world.
> 
> Open:
> 
> [Geo search across anti-meridian doesn't work · Issue #363 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/363)
> 
> -Andrei
> 
> On Sep 9, 9:25 am, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:
> 
> > I think that's what is known as an edge case 🙂
> > 
> > Would you mind opening an issue with a curl recreation?
> > 
> > [Issues · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues)
> > 
> > thanks
> > 
> > Clint

---

<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 6, 2017, 4:19am UTC](https://discuss.elastic.co/t/geo-bounding-box-search-across-anti-meridian/3316/5 "2017-07-06T04:19:31Z")

</div>


