Показать сообщение отдельно
  #1 (permalink)  
Старый 11.01.2021, 19:25
Новичок на форуме
Отправить личное сообщение для drozd2016 Посмотреть профиль Найти все сообщения от drozd2016
 
Регистрация: 11.01.2021
Сообщений: 7

leaflet события на перемещения маркера
Здраствуйте. Пробую править код. У меня есть карта на которой по адрессу я выставляю маркер. Но мне надо перетаскивать маркер и считивать координаты. Помогите пожл. Перетаскивание маркера я сделал. Но при появлении маркера и перетаскивании как сделать считивание координат я незнаю. Вот код:

// Initialize the map and assign it to a variable for later use
var map = L.map('map', {
// Set latitude and longitude of the map center (required)
center: [37.7833, -122.4167],
// Set the initial zoom level, values 0-18, where 0 is most zoomed-out (required)
zoom: 10
});

L.control.scale().addTo(map);

// Create a Tile Layer and add it to the map
//var tiles = new L.tileLayer('http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png').addTo(map);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);


var searchControl = new L.esri.Controls.Geosearch().addTo(map);


var results = new L.LayerGroup().addTo(map);




searchControl.on('results', function(data){
results.clearLayers();
for (var i = data.results.length - 1; i >= 0; i--) {
results.addLayer(L.marker(data.results[i].latlng, {draggable: true}));



}

});


setTimeout(function(){$('.pointer').fadeOut('slow' );},3400);
Ответить с цитированием