Skip to content

Instantly share code, notes, and snippets.

@dimik
Created May 9, 2017 19:39
Show Gist options
  • Save dimik/eba8820e8396b162c61dc71856ee4b1f to your computer and use it in GitHub Desktop.
Save dimik/eba8820e8396b162c61dc71856ee4b1f to your computer and use it in GitHub Desktop.
geocode link example
$('.goto').on('click', function(e) {
e.preventDefault();
var address = $(this).data('map');
ymaps.geocode(address, {
results: 1
}).then(function(res) {
// Выбираем первый результат геокодирования.
var result = res.geoObjects.get(0),
// Координаты геообъекта.
coords = result.geometry.getCoordinates(),
// Область видимости геообъекта.
bounds = result.properties.get('boundedBy');
myMap.geoObjects.add(result);
myMap.setBounds(bounds, {
checkZoomRange: true
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment