sélectionnez deux marqueurs & tracer une ligne entre eux dans la fiche

Je suis très nouveau à la notice.

J'ai plusieurs marqueurs/cercle des Marqueurs tracées sur ma carte en dépliant.

maintenant, je dois tracer une ligne entre les deux marqueurs//cercle des Marqueurs lorsque je les ai choisies.

Quelqu'un peut-il aider à faire cela.

var map = L.map('map').setView([51.49521, -0.10062], 13);
L.tileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', {
        maxZoom: 18,
        attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>'
    }).addTo(map);

 //get all 6 points
  var points = new Array(
[51.49346, -0.11518],
[51.49827, -0.06763],
[51.48331, -0.08154],
[51.52284, -0.09974],
[51.51932, -0.06695],
[51.50949, -0.1363]
   );

  //centerpoint
  var centerPoint = new L.LatLng(51.49521, -0.10062);
  var marker1 = L.marker([51.49521, -0.10062]).addTo(map);


  //adding allo points to map
  for (var i =0 ; i < points.length; i++)
  { 
     //here I can use marker also(if solution is possible with markers)
L.circleMarker([points[i][0],points[i][1]]).addTo(map);
var point = new L.LatLng(points[i][0],points[i][1]);
var pointList = [point, centerPoint];

    var firstpolyline = new L.Polyline(pointList, {
    color: 'red',
    weight: 5,
    smoothFactor: 1

   }).addTo(map);
  }
InformationsquelleAutor vaibhav shah | 2013-03-04