CODE (javascript):
скопировать код в буфер обмена
скопировать код в буфер обмена
- function findAddress(value, print, ballon) {
- value = Drupal.settings.yandex_map.default_place.city + ' ' + value;
- var geocoder = new ymaps.geocode(value, {results: 1});
- geocoder.then(
- function (res) {
- if (res.geoObjects.getLength()) {
- placemarks = res.geoObjects.get(0);
- console.log(placemarks)
- if (print) {
- map.geoObjects.add(placemarks);
- placemarks.balloon.open();
- }
- var points = placemarks.geometry.getCoordinates();
- placemarks.geometry.setCoordinates(points);
- map.panTo(points);
- document.getElementById("edit-yandex-map-item-lat").value = points[0];
- document.getElementById("edit-yandex-map-item-lng").value = points[1];
- document.getElementById("edit-yandex-map-map-center-lat").value = points[0];
- document.getElementById("edit-yandex-map-map-center-lng").value = points[1];
- } else {
- alert("Not found")
- }
- });
- return placemark;
- }