Answer the question
In order to leave comments, you need to log in
How to collect metro stations by address (C#, Yandex Maps API)?
Hello. I can thank you financially.
There is a field that contains the address, you need to transform this field into a metro station.
Yandex maps has an API, and there is a method for implementation.
But I can't collect. It is interesting to get not only the result, but also to understand for the future how to assemble it yourself.
API address https://api.yandex.ru/maps/doc/jsapi...erence/geocode.
ymaps.geocode(myMap.getCenter(), {
/**
* Опции запроса
* @see https://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/geocode.xml
*/
// Ищем только станции метро.
kind: 'metro',
// Запрашиваем не более 1 результатов.
results: 1
}
var coord = "Москва, Красная площадь", // задаем все переменные и получаем адрес
ymaps.geocode(coord).then(function (res) { // кодируем полученный из coords адрес в коордитаны
// проводим обратное геокодирование и ищем 3 ближайшие станции метро
ymaps.geocode(myMap.getCenter(), {
kind: 'metro',
results: 3
}).then(function (met) {
met.geoObjects.options.set('preset', 'islands#redCircleIcon');
var metro = met.geoObjects;
var res = '';
met.geoObjects.each(function (obj) {
res += obj.properties.get('description') + '***';
});
$('#metro').text(res);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question