Simple Leaflet Map
✓ Published0🌍 Public
Dd3noob
Last edited Dec 6, 2019
Created on Dec 6, 2019
This example shows an interactive Leaflet map centered on Wellington, New Zealand, with a layer control that lets the user switch between two base tile layers: OpenStreetMap and OpenTopoMap. Using the Leaflet 1.6.0 JavaScript API, it defines two `L.tileLayer` instances—one pulling raster tiles from `tile.openstreetmap.org` and the other from `tile.opentopomap.org`—and adds them as selectable base layers via `L.control.layers`. The map itself is initialized with `L.map`, set to a zoom level of 14, and displays only the OSM layer initially.
AI-generated descriptionAn example of using leaflet.js with multiple tile layers.
This graph is part of the code samples for the update to the book Leaflet Tips and Tricks to version 1 of leaflet.js.
mit Licensed