mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.09k stars 2.21k forks source link

Globe projection rendering issues around the poles #12026

Open JosefWN opened 2 years ago

JosefWN commented 2 years ago

mapbox-gl-js version:

v2.9.1

browser:

Tested with the same outcome in latest versions of Google Chrome, Firefox and Safari.

Steps to Trigger Behavior

Draw a polyline passing near the North Pole, use satellite map (I used the bathymetry map).

Link to Demonstration

I can email a link if need be, not a public site.

Bugs

  1. Layers are not always fetched at a higher resolution on floating point zoom, such as when scrolling, causing the viewport to remain a low-res raster indefinitely (note vector layer is also rasterized), see 1.png. Resolves if I zoom in more.
  2. Little white dots along tile boundaries (subtle, but highlighted with orange arc superimposed on the image under the dots), see 1.png. More glaring when panning.
  3. Clipping causing large white triangles/polygons near the pole, see 2.png.
  4. A red polyline near the pole shows as an enormous red polygon (interpolation to fill the gap near the pole also affecting layers on top of the base style?), see 2.png.
1 2
SkySails commented 2 years ago

I have an issue that seems quite related. I used the Animate point along a route example and just changed the coordinates around a bit to make the route cross the north pole. This causes a bunch of rendering artifacts and the most obvious ones look very similar to your screenshots!

Here is the codepen: https://codepen.io/SkySails/pen/VwXwJOY?editors=0010

e8ee5a5cabbb1eac359d3eb7c01c6c68 image image

I understand that this is not a "new" issue - similar bugs can be found in Google Maps & Google Earth:

ef28c41ecbf0179e0782bc9e6c8942ff

SnailBones commented 2 years ago

I looked into bug 3 a bit, which seems related to https://github.com/mapbox/mapbox-gl-js/issues/12167 (which I can't reproduce).

The poles borrow their color from the adjacent tile, so if no tile is loaded, the pole color is transparent. We should instead borrow the color from a neighboring tile if no tile is directly adjacent.

Another solution could be just setting the North pole color to be the ocean color (and the south pole to the color of Antarctica) instead of transparent, though this would be less robust with satellite maps or more unique styles (i.e. a map of the moon).

image

image

JosefWN commented 1 year ago

Several of these issues, such as tiles loading at very low resolution (or some tiles loading high-res and some tiles loading low-res within the viewport) and polylines showing up rasterized at very low resolution, only appear at about 68N/68S and onward.

Still, "around the poles", which is part of the title of this issue, is a subjective measure which makes it sound very local. Down south, pretty much all of Antarctica is affected by the bugs, that's a continent larger than Europe. It's like saying there is a bug around Paris, which actually affects the entire continent. Multiply that area by two to include the northern hemisphere as well.

On Antarctica, a partial graticule or tile boundaries also appeared out of nowhere:

Screenshot 2023-04-21 at 23 47 05

All of these issues persist in v2.14.1, in Chrome/Firefox/Safari on Windows/macOS.

JosefWN commented 1 year ago

Maybe some these issues could be related to the fact that when you pan north, Mapbox automatically zooms in on the globe. I saw it works with the scale bar for example (it changes as I pan in globe view), but does this change in zoom level also propagate to the layers on the map, prompting them to re-load (if need be) and re-render?

It seems to me that the zoom is continuously offset, causing low-res tiles and rasterized vectors.