Created
April 19, 2018 07:09
-
-
Save zogreptile/a5d14c3b9a72322ee1f10df0d4ca9237 to your computer and use it in GitHub Desktop.
Метка на яндекс карте по геокодеру.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ymaps.ready(function () { | |
var geocoder = ymaps.geocode("{{ object_item.address }}", {result: 1}); | |
geocoder.then( | |
function (res) { | |
var point = res.geoObjects.get(0), | |
mapCenter = point.geometry.getCoordinates(); | |
var map = new ymaps.Map('map', { | |
center: mapCenter, | |
zoom: 17 | |
}); | |
ymaps.geoQuery(ymaps.geocode("{{ object_item.address }}")).addToMap(map); | |
}, | |
function (err) { | |
console.log("Yandex map geocoder error!"); | |
console.log(err); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment