mapbox/mapbox-gl-js

getStyle then setStyle broken for raster-dem

Open

#8.506 aberto em 18 de jul. de 2019

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (2.203 forks)batch import
bug :lady_beetle:good first issue

Métricas do repositório

Stars
 (10.532 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

mapbox-gl-js version: tested on 1.1.0, probably since forever

browser: Chrome 75.0.3770.100 (Official Build) (64-bit)

Steps to Trigger Behavior

  1. setStyle on a style with raster-dem source
  2. getStyle anytime
  3. setStyle with serialized style object from getStyle

Link to Demonstration

https://jsfiddle.net/srmanc/L20ha5um/1/

Expected Behavior

setStyle should work without error msgs

Actual Behavior

setStyle breaks because bounds and url are set on source but are undefined. Sometimes tiles is undefined on source as well. There are actually two issues:

  1. Why does setStyle break at all if some undefined properties are set on source (this only happens for raster-dem type).
  2. When is it acceptable to call getStyle() to get all the relevant properties on sources - they are set initially so there would be no point in not setting them right away - however, tiles property is missing at the first "styledata" event - please review the jsfiddle example with console.log msgs for more input. We can make this work using delete operator but this seems like a nasty bug.

Guia do colaborador