Forked from tsamaya/tomtom-traffic-with-leaflet.html
Created
September 12, 2025 07:42
-
-
Save Debajyati/d2313f752b7ca0e3f87f57c2258d2cd0 to your computer and use it in GitHub Desktop.
Tomtom Traffic API use with leaflet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Quick Start - Leaflet</title> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" /> | |
| <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" | |
| integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" | |
| crossorigin="" /> | |
| <script src="https://unpkg.com/[email protected]/dist/leaflet.js" | |
| integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" | |
| crossorigin=""></script> | |
| </head> | |
| <body> | |
| <div id="mapid" style="width: 800px; height: 800px;"></div> | |
| <script> | |
| var TOMTOM_API_KEY = 'YOUR-API-KEY'; | |
| var map = L.map('mapid').setView([51.505, -0.09], 15); | |
| L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
| maxZoom: 19, | |
| attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | |
| }).addTo(map); | |
| L.tileLayer('https://api.tomtom.com/traffic/map/4/tile/flow/absolute/{z}/{x}/{y}.png?key=' + TOMTOM_API_KEY, | |
| { attribution: 'TomTom Traffic' } | |
| ).addTo(map); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment