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

fix projection rotation adjustment when more than 180deg #11212

Merged
merged 2 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/geo/projection/adjustments.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function getShearAdjustment(projection, zoom, loc, interpT, withoutRotation?: bo

// Calculate how much the map would need to be rotated to make east-west in
// projected coordinates be left-right
const angleAdjust = -Math.atan(pdy / pdx);
const angleAdjust = -Math.atan2(pdy, pdx);

// Pick a location identical to the original one except for poles to make sure we're within mercator bounds
const mc2 = MercatorCoordinate.fromLngLat(loc);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"version": 8,
"metadata": {
"test": {
"projection": {
"name": "albers",
"parallels": [90, 90],
"center": [10, 30]
},
"width": 64,
"height": 64
}
},
"zoom": 11,
"center": [
-149.91780281066895,
61.191643168038084
],
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "Polygon",
"coordinates": [
[
[
-149.92052793502808,
61.18806530594994
],
[
-149.91771697998047,
61.18877884266747
],
[
-149.9149489402771,
61.188054964719335
],
[
-149.91780281066895,
61.191643168038084
],
[
-149.92052793502808,
61.18806530594994
]
]
]
}
}
},
"sprite": "local://sprites/sprite",
"layers": [
{
"id": "fill",
"type": "fill",
"source": "geojson"
}
]
}