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 all 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 @@ -82,14 +84,14 @@ public double sumTotalOpportunities () {

@Override
public double getLat(int i) {
long y = i / extents.width + extents.north;
return pixelToLat(y, extents.zoom);
final int y = i / extents.width + extents.north;
return pixelToCenterLat(y, extents.zoom);
}

@Override
public double getLon(int i) {
long x = i % extents.width + extents.west;
return pixelToLon(x, extents.zoom);
final int x = i % extents.width + extents.west;
return pixelToCenterLon(x, extents.zoom);
}

@Override
Expand Down