|
13 | 13 | import org.elasticsearch.common.geo.GeoPoint; |
14 | 14 | import org.elasticsearch.geo.GeometryTestUtils; |
15 | 15 | import org.elasticsearch.geometry.Geometry; |
| 16 | +import org.elasticsearch.geometry.LinearRing; |
16 | 17 | import org.elasticsearch.geometry.Point; |
| 18 | +import org.elasticsearch.geometry.Polygon; |
17 | 19 | import org.elasticsearch.geometry.Rectangle; |
18 | 20 | import org.elasticsearch.geometry.utils.StandardValidator; |
19 | 21 | import org.elasticsearch.geometry.utils.WellKnownText; |
@@ -230,6 +232,31 @@ public void testTroublesomeCellLevel4_BoundedGeoShapeCellValues() throws Excepti |
230 | 232 | assertThat("[" + precision + "] bucket count", numBuckets, equalTo(expected)); |
231 | 233 | } |
232 | 234 |
|
| 235 | + public void testIssue96057() throws Exception { |
| 236 | + int precision = 3; |
| 237 | + Geometry geometry = new Polygon( |
| 238 | + new LinearRing( |
| 239 | + new double[] { 47.0, 47.0, -98.41711495022405, -98.41711495022405, 47.0 }, |
| 240 | + new double[] { -43.27504297314639, 23.280704041384652, 23.280704041384652, -43.27504297314639, -43.27504297314639 } |
| 241 | + ) |
| 242 | + ); |
| 243 | + GeoBoundingBox geoBoundingBox = new GeoBoundingBox( |
| 244 | + new GeoPoint(-44.363846082646845, 55.61563600452277), |
| 245 | + new GeoPoint(-75.8747796394427, 42.12290817616412) |
| 246 | + ); |
| 247 | + GeoShapeValues.GeoShapeValue value = geoShapeValue(geometry); |
| 248 | + GeoShapeCellValues cellValues = new GeoShapeCellValues( |
| 249 | + makeGeoShapeValues(value), |
| 250 | + getGridTiler(geoBoundingBox, precision), |
| 251 | + NOOP_BREAKER |
| 252 | + ); |
| 253 | + |
| 254 | + assertTrue(cellValues.advanceExact(0)); |
| 255 | + int numBuckets = cellValues.docValueCount(); |
| 256 | + int expected = expectedBuckets(value, precision, geoBoundingBox); |
| 257 | + assertThat(numBuckets, equalTo(expected)); |
| 258 | + } |
| 259 | + |
233 | 260 | private void assertCorner(long[] h3bins, Point point, int precision, String msg) throws IOException { |
234 | 261 | GeoShapeValues.GeoShapeValue cornerValue = geoShapeValue(point); |
235 | 262 | GeoShapeCellValues cornerValues = new GeoShapeCellValues(makeGeoShapeValues(cornerValue), getGridTiler(precision), NOOP_BREAKER); |
|
0 commit comments