diff --git a/src/data/feature_index.js b/src/data/feature_index.js index 661d2d1a9be..18285a8f5c9 100644 --- a/src/data/feature_index.js +++ b/src/data/feature_index.js @@ -83,7 +83,12 @@ class FeatureIndex { bbox[3] = Math.max(bbox[3], p.y); } - this.grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]); + if (bbox[0] < EXTENT && + bbox[1] < EXTENT && + bbox[2] >= 0 && + bbox[3] >= 0) { + this.grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]); + } } } diff --git a/test/integration/query-tests/edge-cases/box-cutting-antimeridian-z0/expected.json b/test/integration/query-tests/edge-cases/box-cutting-antimeridian-z0/expected.json index fcbe2f6360e..f75f9db7894 100644 --- a/test/integration/query-tests/edge-cases/box-cutting-antimeridian-z0/expected.json +++ b/test/integration/query-tests/edge-cases/box-cutting-antimeridian-z0/expected.json @@ -1,54 +1,28 @@ [ - { - "properties": { - "id": "B" - }, - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - 90, - 0 - ] - } + { + "geometry": { + "type": "Point", + "coordinates": [ + 90, + 0 + ] }, - { - "properties": { - "id": "C" - }, - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - 270, - 0 - ] - } - }, - { - "properties": { - "id": "B" - }, - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - -270, - 0 - ] - } + "type": "Feature", + "properties": { + "id": "B" + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + -90, + 0 + ] }, - { - "properties": { - "id": "C" - }, - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - -90, - 0 - ] - } + "type": "Feature", + "properties": { + "id": "C" } -] + } +] \ No newline at end of file diff --git a/test/integration/query-tests/edge-cases/null-island/expected.json b/test/integration/query-tests/edge-cases/null-island/expected.json index b68c0ec605c..0569af9537f 100644 --- a/test/integration/query-tests/edge-cases/null-island/expected.json +++ b/test/integration/query-tests/edge-cases/null-island/expected.json @@ -1,46 +1,13 @@ [ { - "properties": {}, - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - 0, - 0 - ] - } - }, - { - "properties": {}, - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - 0, - 0 - ] - } - }, - { - "properties": {}, - "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 0, 0 ] - } - }, - { - "properties": {}, + }, "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - 0, - 0 - ] - } + "properties": {} } ] \ No newline at end of file