Skip to content

Commit

Permalink
fix projection rotation adjustment when more than 180deg (#11212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis authored and SnailBones committed Nov 5, 2021
1 parent 39a29c3 commit a8f35ca
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
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"
}
]
}

0 comments on commit a8f35ca

Please sign in to comment.