rodolpheg

Untitled

Feb 27th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <head>
  5. <title>Une carte editable par les utilisateurs/trices</title>
  6. <meta charset="UTF-8">
  7. <!-- https://leafletjs.com/download.html -->
  8. <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
  9. <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
  10. <style>
  11. /* On indique la taille de l'emplacement de la carte*/
  12. html, body {height: 100%; margin: 0;}
  13. #Carte { width: 100%; height: 100%; }
  14. </style>
  15. </head>
  16. <body>
  17. <!-- Div où se trouvera la carte -->
  18. <div id='Carte'></div>
  19. <script>
  20. // créer la carte, remplacez VOTRE_TOKEN pour la clef que vous trouverez là : https://account.mapbox.com
  21. //var fondDeCarte = L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/outdoors-v11/tiles/{z}/{x}/{y}?access_token=VOTRE_TOKEN');
  22. // décochez la ligne suivante si vous n'avez pas de compte MapBox
  23. var fondDeCarte = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
  24. var maCarte = L.map('Carte', {
  25. center: [45.52,-73.63],
  26. zoom: 13,
  27. layers: fondDeCarte,
  28. zoomControl: false
  29. });
  30. maCarte.setView([0,0], 2);
  31.  
  32. //Ajout d'un marqueur sur la carte par l'intermédiaire d'un objet GeoJSON
  33. L.geoJSON({"type": "Feature","geometry": {"type": "Point","coordinates": [74,58]}}).addTo(maCarte);
  34. </script>
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment