Advertisement
contatowellington

Untitled

Nov 3rd, 2017
1,540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5. <title>Quick Start - Leaflet</title>
  6.  
  7. <meta charset="utf-8" />
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9.  
  10. <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
  11.  
  12. <link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css" integrity="sha512-M2wvCLH6DSRazYeZRIm1JnYyh22purTM+FDB5CsyxtQJYeKq83arPe5wgbNmcFXGqiSH2XR8dT/fJISVA1r/zQ==" crossorigin=""/>
  13. <script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js" integrity="sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log==" crossorigin=""></script>
  14.  
  15.  
  16.  
  17. </head>
  18. <body>
  19.  
  20.  
  21.  
  22. <div id="mapid" style="width: 600px; height: 400px;"></div>
  23. <script>
  24.  
  25. var mymap = L.map('mapid').setView([51.505, -0.09], 13);
  26.  
  27. L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
  28. maxZoom: 18,
  29. attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
  30. '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
  31. 'Imagery © <a href="http://mapbox.com">Mapbox</a>',
  32. id: 'mapbox.streets'
  33. }).addTo(mymap);
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. var popup = L.popup();
  44.  
  45. function onMapClick(e) {
  46. popup
  47. .setLatLng(e.latlng)
  48. .setContent("You clicked the map at " + e.latlng.toString())
  49. .openOn(mymap);
  50. }
  51.  
  52. mymap.on('click', onMapClick);
  53.  
  54. </script>
  55.  
  56.  
  57.  
  58. </body>
  59. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement