Advertisement
rodolpheg

Untitled

Feb 16th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Un titre</title>
  5. <meta charset="UTF-8">
  6. <!-- Téléchargement de la bibliothèque Leaflet.js -->
  7. <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
  8. <!-- Téléchargement des instructions CSS de Leaflet, qui serviront à styliser les éléments de l'interface de la carte -->
  9. <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
  10.  
  11. <style>
  12. html, body {height: 100%; margin: 0;}
  13. #Carte {width: 100%; height: 100%;}
  14. </style>
  15. </head>
  16. <body>
  17. <!-- Création d'un <div> qui contiendra notre carte-->
  18. <div id='Carte'></div>
  19.  
  20. <!-- Début du script JavaScript-->
  21. <script>
  22. // Création d'une variable "maCarte" qui contiendra... ma carte.
  23. maCarte = L.map('Carte')
  24. // On donne une position lat lng et un niveau de zoom par défaut
  25. maCarte.setView([45,-73], 3)
  26. // On définit notre fond de carte qui téléchargera les tuiles avec l'API OSM
  27. fondDeCarte = L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png')
  28. // J'attache ce fond de plan à ma carte
  29. fondDeCarte.addTo(maCarte)
  30. </script>
  31. </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement