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

ES barfs on 3D coordinates #10510

Closed
hukka opened this issue Apr 9, 2015 · 0 comments · Fixed by #10539
Closed

ES barfs on 3D coordinates #10510

hukka opened this issue Apr 9, 2015 · 0 comments · Fixed by #10539
Assignees
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes

Comments

@hukka
Copy link

hukka commented Apr 9, 2015

GeoJSON allows for altitude/elevation data in coordinates: "A position is represented by an array of numbers. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system)."

Unfortunately ES does not like this at all. For example

"location": {"coordinates": [[21.758451554932154, 59.94981396923298, 4.606], [21.758562151951164, 59.94958900257331, 4.507], [21.758594573325485, 59.949384308291066, 5.845], [21.758506828193497, 59.94908418029604, 8.552], [21.75850445683433, 59.9489969477522, 8.753], [21.75851567477881, 59.94896506422581, 8.745], [21.758709217831672, 59.94875661966012, 7.749], [21.758812419950235, 59.94852881190606, 6.785], [21.758934003178023, 59.9481809000838, 5.878], [21.75894258819726, 59.948156920023145, 5.831]], "type": "LineString"}

returns

org.elasticsearch.ElasticsearchParseException: Invalid number of points in LineString (found 1 - must be >= 2)
at org.elasticsearch.common.geo.builders.ShapeBuilder$GeoShapeType.parseLineString(ShapeBuilder.java:838)
at org.elasticsearch.common.geo.builders.ShapeBuilder$GeoShapeType.parse(ShapeBuilder.java:757)
at org.elasticsearch.common.geo.builders.ShapeBuilder.parse(ShapeBuilder.java:289)
at org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper.parse(GeoShapeFieldMapper.java:242)
... 12 more

(linenumbers do not match to master HEAD in github, but the problem is in parseCoordinates method).
The limitation is not mentioned in the documentation either (or at least it wasn't on the geo_shape page).

@nknize nknize self-assigned this Apr 10, 2015
@nknize nknize added the :Analytics/Geo Indexing, search aggregations of geo points and shapes label Apr 10, 2015
nknize added a commit to nknize/elasticsearch that referenced this issue Apr 10, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes elastic#10510
nknize added a commit to nknize/elasticsearch that referenced this issue Apr 10, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes elastic#10510
nknize added a commit to nknize/elasticsearch that referenced this issue Apr 10, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes elastic#10510
nknize added a commit that referenced this issue Apr 10, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes #10510
nknize added a commit that referenced this issue Apr 10, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes #10510
nknize added a commit that referenced this issue Apr 10, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes #10510
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes elastic#10510
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
… dimension

ShapeBuilder's coordinate parser expected 2 double values for every coordinate array. If > 2 doubles were provided the parser terminated parsing of the coordinate array. This resulted in an invalid Shape state leaving LineStrings, LinearRings, and Polygons with a single coordinate. An incorrect parse exception was thrown. This corrects the parser to ignore those values in the 3rd+ dimension, correctly parsing the rest of the coordinate array.

Unit tests have been updated to verify the fix.

closes elastic#10510
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants