Skip to content

Commit

Permalink
Revert "[GEO] Correct ShapeBuilder coordinate parser to ignore values…
Browse files Browse the repository at this point in the history
… in 3rd+ dimension"

This reverts commit adf349d.
  • Loading branch information
nknize committed Apr 10, 2015
1 parent adf349d commit eecb928
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
Expand Up @@ -250,9 +250,6 @@ private static CoordinateNode parseCoordinates(XContentParser parser) throws IOE
token = parser.nextToken();
double lat = parser.doubleValue();
token = parser.nextToken();
while (token == XContentParser.Token.VALUE_NUMBER) {
token = parser.nextToken();
}
return new CoordinateNode(new Coordinate(lon, lat));
} else if (token == XContentParser.Token.VALUE_NULL) {
throw new ElasticsearchIllegalArgumentException("coordinates cannot contain NULL values)");
Expand Down
Expand Up @@ -115,32 +115,6 @@ public void testParse_circle() throws IOException {
assertGeometryEquals(expected, multilinesGeoJson);
}

public void testParse_multiDimensionShapes() throws IOException {
// multi dimension point
String pointGeoJson = XContentFactory.jsonBuilder().startObject().field("type", "Point")
.startArray("coordinates").value(100.0).value(0.0).value(15.0).value(18.0).endArray()
.endObject().string();

Point expectedPt = GEOMETRY_FACTORY.createPoint(new Coordinate(100.0, 0.0));
assertGeometryEquals(new JtsPoint(expectedPt, SPATIAL_CONTEXT), pointGeoJson);

// multi dimension linestring
String lineGeoJson = XContentFactory.jsonBuilder().startObject().field("type", "LineString")
.startArray("coordinates")
.startArray().value(100.0).value(0.0).value(15.0).endArray()
.startArray().value(101.0).value(1.0).value(18.0).value(19.0).endArray()
.endArray()
.endObject().string();

List<Coordinate> lineCoordinates = new ArrayList<>();
lineCoordinates.add(new Coordinate(100, 0));
lineCoordinates.add(new Coordinate(101, 1));

LineString expectedLS = GEOMETRY_FACTORY.createLineString(
lineCoordinates.toArray(new Coordinate[lineCoordinates.size()]));
assertGeometryEquals(jtsGeom(expectedLS), lineGeoJson);
}

public void testParse_envelope() throws IOException {
// test #1: envelope with expected coordinate order (TopLeft, BottomRight)
String multilinesGeoJson = XContentFactory.jsonBuilder().startObject().field("type", "envelope")
Expand Down Expand Up @@ -593,12 +567,11 @@ public void testParse_polygonWithHole() throws IOException {
.endArray()
.endObject().string();

// add 3d point to test ISSUE #10501
List<Coordinate> shellCoordinates = new ArrayList<>();
shellCoordinates.add(new Coordinate(100, 0, 15.0));
shellCoordinates.add(new Coordinate(100, 0));
shellCoordinates.add(new Coordinate(101, 0));
shellCoordinates.add(new Coordinate(101, 1));
shellCoordinates.add(new Coordinate(100, 1, 10.0));
shellCoordinates.add(new Coordinate(100, 1));
shellCoordinates.add(new Coordinate(100, 0));

List<Coordinate> holeCoordinates = new ArrayList<>();
Expand Down

0 comments on commit eecb928

Please sign in to comment.