2015-09-18 13 views
0

畫保存在變量折線和latlongs。如何計算經緯度基地像素:我與葉api.Where用戶工作單張

我一直在尋找它想採取latlongs並計算pixels.Found的layerPoint功能,但因爲我有小葉低的理解,不能使用該功能的小冊子功能。

我用2個變量存儲兩個經緯度參數,但不知道如何在layerPoint功能使用它們。

腳本

var polyline = new L.Polyline([]); 
      var aa; 
      var bb; 
      function getDist(e) { 
       // New marker on coordinate, add it to the map 
       // Add coordinate to the polyline 
       polyline.addLatLng(e.latlng).addTo(map).bindPopup(); 
       var ccc = prompt('1st or 2nd'); 
       if (ccc == '1') { aa = e.latlng} 
       else if (ccc == '2') { bb = e.latlng; convertIt(); 
       } 
      } 

      function convertIt(e) 
      { 
       var getit = e.latLngToPoint(latlng, map.getZoom()); 
      } 

如果有人可以幫助,你的時間

回答

1

latLngToPoint請不要help.thanks是L.Map的方法。你需要一個latLng作爲參數傳遞給您的convertIt功能,然後return map.latLngToPoint(e),假設你保持e作爲參數名稱convertIt

+0

感謝回答,我真的很感激你的努力 –

相關問題