create two color border in leaflet polygon - Javascript Leaflet

Javascript examples for Leaflet:Polygon

Description

create two color border in leaflet polygon

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="http://cdn.leafletjs.com/leaflet/v1.0.0-rc.1/leaflet.css"> 
      <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet/v1.0.0-rc.1/leaflet.js"></script> 
      <script type="text/javascript" src="https://bbecquet.github.io/Leaflet.PolylineOffset/leaflet.polylineoffset.js"></script> 
      <style id="compiled-css" type="text/css">

#map {// w w w . j  a va2  s.  co 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.6, 0.5], 8);
L.polyline([
   [48.3, 0.1],
  [48.3, 0.7],
  [48.7, 0.7],
  [48.7, 0.1],
  [48.3, 0.1]
], {
   fillColor: "none",
  weight: 4,
  lineJoin: "miter",
  color: "red"
}).addTo(map);
L.polyline([
   [48.3, 0.1],
  [48.3, 0.7],
  [48.7, 0.7],
  [48.7, 0.1],
  [48.3, 0.1]
], {
   fillColor: "none",
  weight: 4,
  lineJoin: "miter",
  color: "black",
  offset: -4 // Thanks to Leaflet Polyline Offset plugin
}).addTo(map);
    }

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

Related Tutorials