Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Document that null style URL is necessary when using a styleLayer and passing map options #1339

Open
malwoodsantoro opened this issue Oct 31, 2020 · 0 comments

Comments

@malwoodsantoro
Copy link
Contributor

It's necessary to pass in null for the style URL when using map options. This isn't clear in the documentation. This is especially noticeable for users trying to migrate from Classic styles to the modern Static Tiles endpoint.

Map does not render with tile_layer.js:49 Uncaught TypeError: Cannot read property '0' of undefined error:

var map = L.mapbox.map('map', {maxZoom: 3})
    .setView([40, -74.50], 1)
    .addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'));

Map renders as expected:

var map = L.mapbox.map('map', null, {maxZoom: 3})
    .setView([40, -74.50], 1)
    .addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'));
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant