var map,
testLayer,
LatCenter = '', LngCenter = '',
Lat1 = '', Lng1 = '', Lat2 = '', Lng2 = '';
$(document).ready(function()
{
var zoomFactor = 18;
map = L.map("mapPlace", {zoomControl: false});
map.setView([LatCenter, LngCenter], zoomFactor);
DoubleGISTileLayer = L.tileLayer
(
// "http://localhost/webwarehouse/tiles/2GIS/{z}/{x}/{y}.png",
// Путь к своим тайлам
{
minZoom: 12,
maxZoom: 18,
attribution: "",
errorTileUrl: "images/error-tile-image.png",
tms: false
}
).addTo(map);
});
function testFunction()
{
if(map.hasLayer(testLayer)){map.removeLayer(testLayer);}
testLayer = new L.FeatureGroup();
fragment1 = new L.polyline
([
[Lat1, Lng1],
[Lat2, Lng2]
]);
fragment1.setStyle({"color": "red", "weight": 2});
testLayer.addLayer(fragment1);
map.addLayer(testLayer);
}