Leaflet - Adding Popups to GeoJSON point used in Multiple Toggle Layers - Javascript Leaflet

Javascript examples for Leaflet:Layer

Description

Leaflet - Adding Popups to GeoJSON point used in Multiple Toggle Layers

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <link rel="stylesheet" type="text/css" href="https://npmcdn.com/leaflet@1.0.0-rc.2/dist/leaflet.css"> 
      <script type="text/javascript" src="https://npmcdn.com/leaflet@1.0.0-rc.2/dist/leaflet-src.js"></script> 
      <style id="compiled-css" type="text/css">

#map {/*from w  w w .j ava2  s.  c o m*/
   height: 500px;
}


      </style> 
      <script type="text/javascript">
    window.onload=function(){
var map = L.map("map");
L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png").addTo(map);
map.setView([48.85, 2.35], 12);
var marker = L.marker([48.85, 2.35]),
   group1 = L.layerGroup([marker]).addTo(map),
  group2 = L.layerGroup([marker]).addTo(map);
L.control.layers(null, {
   "Group 1": group1,
  "Group 2": group2
}, {
   collapsed: false
}).addTo(map);
    }

      </script> 
   </head> 
   <body> 
      <div id="map"></div>  
   </body>
</html>

Related Tutorials