javascript - Creating MultiPolyline with leaflet Js -


in past (leaflet version 0.7) used code

var multipolyline = l.multipolyline([[[35.10418, -106.62987],[35.19738, -106.875],[35.07946, -106.80634]],[[35.11654, -106.58318],[35.13142, -106.48876],[35.07384, -106.52412]]],{color: 'red',weight:8}).addto(map); 

for creating layer multiple polylines.

<html> <head> <title>eine osm karte mit leaflet</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.1.0/dist/leaflet.css" /> </head> <body> <script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>  <div id="map" style="width: 600px; height: 400px"></div> <script> var map = l.map('map', { center: [35.10418, -106.62987], zoom: 10 }); l.tilelayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addto(map); var multipolyline = l.multipolyline([[[35.10418, -106.62987],[35.19738, -106.875],[35.07946, -106.80634]],[[35.11654, -106.58318],[35.13142, -106.48876],[35.07384, -106.52412]]],{color: 'red',weight:8}).addto(map); </script> </body> </html> 

this code not work current leaflet version 1.0.0 , not find class multipolyline in leaflet documentation (http://leafletjs.com/reference-1.1.0.html). think removed.

how can create layer many polylines on it? have create each polyline , add layer or there function accomplish this?

according changelog can use l.polyline:

removed multipolyline , multipolygon classes since multiple rings handled polyline , polygon classes respectively. layers multiple rings perform better (since each physically single path object instead of being featuregroup of layers).

https://github.com/leaflet/leaflet/blob/master/changelog.md


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -