Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pixel centers as points in web Mercator grids #894

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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