Answer the question
In order to leave comments, you need to log in
How to get the coordinates of all points on the yandex map?
I want to implement point filters by country, city and region.
I think to do it this way:
1. Get the coordinates of all points on the page (points are added by users to the map (there is a button "add a label"))
2. Get data about each point using reverse geocoding (That's what I need the coordinates for)
3 Next, filter these points depending on the country, region, city
I tried to get the coordinates of all points through this method , but it didn’t work out for me:
myMap.GeoObjects(ymaps);
GeoObjects(myMap);
myMap.GeoObjects(myMap);
ymaps.GeoObjects(myMap);
myMap.GetObjects;
Answer the question
In order to leave comments, you need to log in
here is a piece of code from my application.
MapClick(e){
var coords = e.get('coords');
tmp = {
id: 4,
coords: coords,
icon: {content: coords}};
// тут вся магия. ymaps.geocode прочитай про это в документации
var geo = ymaps.geocode(coords);
geo.then((res)=>{
var firstGeoObject = res.geoObjects.get(0);
console.log(firstGeoObject.properties.get('text'));
var objs = res.geoObjects.toArray();
var YmapCoords = objs[0].geometry.getCoordinates();
},
function (err) {
// Обработка ошибки.
}
);
// console.log(tmp);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question