Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geo: linestrings crossing dateline from west to east are not indexed correctly #43775

Closed
imotov opened this issue Jun 28, 2019 · 1 comment · Fixed by #46601
Closed

Geo: linestrings crossing dateline from west to east are not indexed correctly #43775

imotov opened this issue Jun 28, 2019 · 1 comment · Fixed by #46601
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug

Comments

@imotov
Copy link
Contributor

imotov commented Jun 28, 2019

When a linestring that crosses the dateline from west to east is decomposed, it creates a segment that spans the globe, producing wrong hits. To reproduce: we index a ">" shaped object crossing the dateline twice and then search by intersection with linesting stretching along prime meridian.


DELETE test

PUT test
{
  "mappings": {
    "properties": {
      "shape": {
        "type": "geo_shape"
      }
    }
  }
}

PUT test/_doc/1
{
  "shape": "LINESTRING(160 0,200 10,160 20)"
}

POST test/_search
{
  "query": {
    "geo_shape": {
      "shape": {
        "shape": "LINESTRING(0 -50,0 50)",
        "relation": "intersects"
      }
    }
  }
}

During indexing the decomposition of "LINESTRING(160 0,200 10,160 20)" produces multilinestring ((160.0 0.0, 180.0 5.0),(180.0 5.0, -160.0 10.0, 180.0 15.0),(180.0 15.0, 160.0 20.0)) instead of MULTILINESTRING ((160 0, 180 5), (-180 5, -160 10, -180 15), (180 15, 160 20)) that was produced before. See https://gist.github.com/imotov/cc5d4c42cd9aa1b7dc47d892476f1d46 for illustration of the shapes specified in the repo above, and decomposed shapes in buildS4J and buildGeometry methods. The issue seems to stem from normalizeLon call that was added to buildGeometry and converts -180 to 180.

@imotov imotov added >bug :Analytics/Geo Indexing, search aggregations of geo points and shapes labels Jun 28, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo

imotov added a commit to imotov/elasticsearch that referenced this issue Sep 11, 2019
Fixes that way linestrings that are crossing the antimeridian are
indexed due to a normalization bug these lines were decomposed into
a line segment that was stretching entire globe.

Fixes elastic#43775
imotov added a commit that referenced this issue Sep 11, 2019
…an (#46601)

Fixes that way linestrings that are crossing the antimeridian are
indexed due to a normalization bug these lines were decomposed into
a line segment that was stretching entire globe.

Fixes #43775
imotov added a commit that referenced this issue Sep 11, 2019
…an (#46601)

Fixes that way linestrings that are crossing the antimeridian are
indexed due to a normalization bug these lines were decomposed into
a line segment that was stretching entire globe.

Fixes #43775
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants