From f23b3fcf650cab1cb064b8e8f362e257b3d60ac6 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Tue, 17 Oct 2023 13:39:09 +0200 Subject: [PATCH] Use pixel centers in WebMercatorGridPointSet All other uses of pixel edge functions now seem to be only for finding bounds of pixels, the entire grid, or extents. Point positions should now be uniformly in the center of Mercator pixels. --- .../conveyal/r5/analyst/WebMercatorGridPointSet.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java b/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java index bc5475c2c..55a01f028 100644 --- a/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java +++ b/src/main/java/com/conveyal/r5/analyst/WebMercatorGridPointSet.java @@ -12,6 +12,8 @@ import static com.conveyal.r5.analyst.Grid.latToPixel; import static com.conveyal.r5.analyst.Grid.lonToPixel; +import static com.conveyal.r5.analyst.Grid.pixelToCenterLat; +import static com.conveyal.r5.analyst.Grid.pixelToCenterLon; import static com.conveyal.r5.analyst.Grid.pixelToLat; import static com.conveyal.r5.analyst.Grid.pixelToLon; import static com.conveyal.r5.common.GeometryUtils.checkWgsEnvelopeSize; @@ -115,14 +117,14 @@ public double sumTotalOpportunities () { @Override public double getLat(int i) { - long y = i / this.width + this.north; - return pixelToLat(y, zoom); + final int y = i / this.width + this.north; + return pixelToCenterLat(y, zoom); } @Override public double getLon(int i) { - long x = i % this.width + this.west; - return pixelToLon(x, zoom); + final int x = i % this.width + this.west; + return pixelToCenterLon(x, zoom); } @Override