Skip to content

Error: terrain: terrain is missing required property "source" when use projection: "globe" ! #55

@DennisGuo

Description

@DennisGuo

When I use {projection: "globe"} to init map will cause th error .

const map = new mapboxgl.Map({
    container: "map", // container ID
    style: "mapbox://styles/mapbox/dark-v10", // style URL
    center: [106.55, 29.57], // starting position [lng, lat]
    zoom: 2, // starting zoom
    projection: "globe", // display the map as a 3D globe
  });
  map.addControl(
    new MapboxLanguage({
      defaultLanguage: "zh-Hans",
    })
  );

The error info

Error: terrain: terrain is missing required property "source"
    at Object.Mi [as emitValidationErrors] (validate_style.js:13:41)
    at Ht (style.js:57:5)
    at ei.setState (style.js:647:13)
    at Map._updateDiff (map.js:1887:28)
    at Map._diffStyle (map.js:1881:18)
    at Map.setStyle (map.js:1822:18)
    at MapboxLanguage._initialStyleUpdate (index.js:141:13)
    at Map.fire (evented.js:129:26)
    at ei.fire (evented.js:144:24)
    at ei._load (style.js:355:14)

if i do not use {projection: "globe"} , it work find !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions