maplibre / maplibre-gl-js

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

`line-pattern`s that use a `step` expression don't work at all zoom levels #4787

Open lkskrt opened 1 month ago

lkskrt commented 1 month ago

Hi, I think I have identified an issue that affects line-patterns that use a step expression.

maplibre-gl-js version: 4.7.1 browser: At least Chrome and Firefox

Steps to Trigger Behavior

Configure a style that uses a step expression as a value for line-pattern paint:

new Map({
  style: {
    layers: [
      {
        paint: {
          'line-pattern': [
            'step',
            ['zoom'],
            'railway-small',
            13,
            'railway-large',
          ],
        },
      },
    ],
  },
  zoom: 13.1,
};

Link to Demonstration

https://stackblitz.com/edit/maplibre-sprite-test

Expected Behavior

The sprite railway-large should be rendered when the zoom level is greater than 13.

image

Actual Behavior

Only thin lines are rendered after the map mounts at zoom level 13.1:

image

It is necessary to zoom in and out again a couple of times for the correct sprites to show up.

HarelM commented 1 month ago

Might be similar to the following bug: