Ledger Nano X - The secure hardware wallet
SHARE
TWEET

geo set marker

krot Apr 3rd, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.4.0/dist/leaflet.css" integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" crossorigin=""/>
  13.     <script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js" integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==" 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 map = L.map('mapid').setView([ 11,22], 14);
  26.  
  27.     L.tileLayer(
  28.  'https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}'
  29.    
  30.     , {
  31.        
  32.         subdomains:['mt0','mt1','mt2','mt3'],
  33.         maxZoom: 18,
  34.         id: 'mapbox.streets'
  35.     }).addTo(map);
  36.  
  37.  
  38.    
  39.     var LeafIcon = L.Icon.extend({
  40.     options: {
  41.         shadowUrl: 'https://leafletjs.com/examples/custom-icons/leaf-shadow.png',
  42.         iconSize:     [38, 95],
  43.         shadowSize:   [50, 64],
  44.         iconAnchor:   [22, 94],
  45.         shadowAnchor: [4, 62],
  46.         popupAnchor:  [-3, -76]
  47.     }
  48. });
  49.  
  50. var greenIcon = new LeafIcon({iconUrl: 'https://leafletjs.com/examples/custom-icons/leaf-green.png'}),
  51.     redIcon = new LeafIcon({iconUrl: 'https://leafletjs.com/examples/custom-icons/leaf-red.png'}),
  52.     orangeIcon = new LeafIcon({iconUrl: 'https://leafletjs.com/examples/custom-icons/leaf-orange.png'});
  53.    
  54.    
  55.    
  56. L.icon = function (options) {
  57.     return new L.Icon(options);
  58. };
  59.  
  60.  
  61. var marker;
  62. map.on('click', function (e) {
  63.     if (marker) { // check
  64.         map.removeLayer(marker); // remove
  65.     }
  66.    
  67.     marker = L.marker(e.latlng,{icon: greenIcon}).addTo(map).bindPopup('<strong>hi</strong><br>h.').openPopup();
  68.    
  69.    
  70.  
  71. });
  72.  
  73. </script>
  74.  
  75.  
  76.  
  77. </body>
  78. </html>
  79.  
  80.  
  81.  
  82.  
  83.  
  84. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top