maplibre / maplibre-gl-js

MapLibre GL JS - Interactive vector tile maps in the browser
https://maplibre.org/maplibre-gl-js/docs/
Other
6.72k stars 718 forks source link

Images in symbol features with placement other than "point" get scaled when moving the globe around the poles #5090

Open JakubJagoda opened 3 days ago

JakubJagoda commented 3 days ago

maplibre-gl-js version: 5.0.0-pre.7 EDIT: I originally created this issue against version 5.0.0-pre.6, but then I noticed that 5.0.0-pre.7 was out, so checked against it as well and updated the description.

browser: Chrome 131.0.6778.85 (Official Build) (arm64) / Firefox 132.0b9 (aarch64)

Steps to Trigger Behavior

  1. Create map with globe projection
  2. Add a symbol layer rendering an image with symbol-placement set to value other than "point"
  3. Move the globe so that one of the poles is in the center

Link to Demonstration

https://codepen.io/kuba-jagoda-asi/pen/YzmojqQ

Expected Behavior

The rendered image should visually retain its size

Actual Behavior

The image gets scaled up way too much

Some more info

It seems that this was also enlarging texts, but has been fixed somewhere between 5.0.0-pre.1 and 5.0.0-pre.6 (if you change the version to 5.0.0-pre.1 in the pen and repeat the steps, you'll see that the text was also scaled. This doesn't happen on 5.0.0-pre.6). This + the fact that it doesn't happen in Mapbox (example for reference: https://codepen.io/kuba-jagoda-asi/pen/JjgQBJE?editors=1010) makes be believe that it's not intended, but rather a bug. Changing layer's symbol-placement to point prevents this from happening. So does changing icon-pitch-alignment to "viewport". But both render the layer in a bit different way (the image is not "sticked" to the globe anymore, but rather faces the camera). Here's some images to quickly show what I'm talking about:

Maplibre 5.0.0-pre.6 (notice the large gray trapezoid): Image

Mapbox (the image remained non-scaled): Image

Maplibre 5.0.0-pre.1 (where text also got scaled - but this was fixed): Image

HarelM commented 3 days ago

I'm guessing you are referring to this issue, right?

Which was fixed by the following PR as part of pre.5

CC: @kubapelc

JakubJagoda commented 3 days ago

@HarelM yeah, I guess that was the issue for text. But just to be sure we're on the same page - this issue is about image. I only mentioned the text, because seeing it suffered similar problem and being fixed at some point, confirms to me that what I'm seeing with image is indeed a bug.

HarelM commented 3 days ago

Sure, sure, I'm expecting a similar solution, that's why I mentioned it.