Answer the question
In order to leave comments, you need to log in
How to determine a place by a point on the map?
How to determine the address by moving point on the map?
Answer the question
In order to leave comments, you need to log in
Listen for dragend event, perform reverse geocoding :
<div>{{ address }}</div>
<div ref="map"></div>
data: () => ({
coords: [ ... ],
address: '',
}),
mounted() {
ymaps.ready(() => {
const map = new ymaps.Map(this.$refs.map, { ... });
const marker = new ymaps.Placemark(this.coords, {}, {
draggable: true,
});
marker.events.add('dragend', e => {
this.coords = e.get('target').geometry.getCoordinates();
});
map.geoObjects.add(marker);
this.$watch('coords', {
immediate: true,
handler(coords) {
ymaps.geocode(coords).then(r => {
this.address = r.geoObjects.get(0).properties.get('name');
});
},
});
});
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question