diff --git a/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java b/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java index 55a01f028..95a1b6ab6 100644 --- a/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java +++ b/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java @@ -131,6 +131,7 @@ public double getLon(int i) { public TIntList getPointsInEnvelope (Envelope envelopeFixedDegrees) { // Convert fixed-degree envelope to floating, then to world-scale web Mercator pixels at this grid's zoom level. // This is not very DRY since we do something very similar in the constructor and elsewhere. + // These are the integer pixel numbers containing the envelope, so iteration below must be inclusive of the max. int west = lonToPixel(fixedDegreesToFloating(envelopeFixedDegrees.getMinX()), zoom); int east = lonToPixel(fixedDegreesToFloating(envelopeFixedDegrees.getMaxX()), zoom); int north = latToPixel(fixedDegreesToFloating(envelopeFixedDegrees.getMaxY()), zoom); diff --git a/src/test/java/com/conveyal/r5/analyst/WebMercatorExtentsTest.java b/src/test/java/com/conveyal/r5/analyst/WebMercatorExtentsTest.java index 310166529..e0600cb6e 100644 --- a/src/test/java/com/conveyal/r5/analyst/WebMercatorExtentsTest.java +++ b/src/test/java/com/conveyal/r5/analyst/WebMercatorExtentsTest.java @@ -26,7 +26,7 @@ class WebMercatorExtentsTest { * digits (as when they are stored in a database or serialized over the wire). */ @ParameterizedTest - @ValueSource(ints = {9, 10, 11}) + @ValueSource(ints = {9, 10, 11, 12}) void wgsMercatorStability (int zoom) { Envelope wgsEnvelope = new Envelope(); wgsEnvelope.expandToInclude(10.22222222, 45.111111); @@ -49,7 +49,7 @@ void wgsMercatorStability (int zoom) { * one cell (rather than zero cells). Also check an envelope with a tiny nonzero envelope away from cell edges. */ @ParameterizedTest - @ValueSource(ints = {9, 10, 11}) + @ValueSource(ints = {9, 10, 11, 12}) void singleCellExtents (int zoom) { Envelope wgsEnvelope = new Envelope();