UNPKG

829 BHTMLView Raw
1---
2layout: example.html
3title: Reusable Source
4shortdesc: Updating a tile source by changing the URL.
5docs: >
6 You can call <code>source.setUrl()</code> to update the URL for a tile source. Note that when you change the URL for a tile source, existing tiles will not be replaced until new tiles are loaded. If you are interested instead in clearing currently rendered tiles, you can call the <code>source.refresh()</code> method. Alternatively, you can use two separate sources if you want to remove rendered tiles and start over loading new tiles.
7---
8<div id="map" class="map"></div>
9<button class="switcher" value="0">January</button>
10<button class="switcher" value="1">January (with bathymetry)</button>
11<button class="switcher" value="2">July</button>
12<button class="switcher" value="3">July (with bathymetry)</button>