mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

`['distance-from-center']` is barely usable when terrain is enabled

Open brncsk opened this issue 3 years ago • 0 comments

The return value of Transform#calculateDistanceTileData() seems to be dependent on terrain state (probably via Transform#cameraWorldSize?)

This makes it near-impossible to choose a static threshold value for distance-based symbol filtering (e.g. ["<=", ["distance-from-center"], n]) that yields a visually acceptable result regardless of terrain.

Also, it's pretty easy to choose a threshold value where symbols in tiles close to the camera get culled even though intuitively they should show up – this might or might not be another bug (possibly related: https://github.com/mapbox/mapbox-gl-js/issues/11455).

Please note that this is also happening when the projection is mercator (see https://github.com/mapbox/mapbox-gl-js/issues/11243 for a similar issue w/ other projections).

mapbox-gl-js version: 2.11.0 browser: Google Chrome 107.0.5304.110

Steps to Trigger Behavior

  1. Enable distance-based filtering for some symbol layers using ['distance-from-center']
  2. Enable terrain w/ exaggeration set to some value > 0
  3. Pitch the map to ~70 deg so the issue is visible
  4. Observe that filter state is dependent on the terrain's exaggeration

Expected Behavior

Optimally I should be able to empirically choose a value which yields an acceptable visual result that does not depend on the terrain.

Actual Behavior

Cannot determine such a value, the acceptable range changes wildly depending on the terrain's height in the viewport.

brncsk avatar Nov 25 '22 10:11 brncsk