Skip to content

Commit

Permalink
Use pixel centers in WebMercatorGridPointSet
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
abyrd committed Oct 19, 2023
1 parent 2d64566 commit f23b3fc
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f23b3fc

Please sign in to comment.