R
R
Rillai2020-12-01 22:41:37
JavaScript
Rillai, 2020-12-01 22:41:37

Card through which you can specify the address?

I have a task to add a map to the site through which you can get the address. I chose react-yandex-map for this case, and everything seems to be fine, except for one thing. I do not know how to get the data that comes after finding an address, tell me who has already done this, or if you know other options with a map.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Malakhov-web, 2020-12-02
@malahov-web

Are you talking about geocoding?
https://yandex.ru/dev/maps/jsbox/2.1/direct_geocode/
In the example in the dock, firstGeoObject stores everything about the object.
console.log('All geo object data: ', firstGeoObject.properties.getAll());
I had a task finding an object at the address will receive its coordinates from the geocoder.
In this case, add after p.90
something like
setObjNewCoordinates(coords);

function setObjNewCoordinates(сoords) {
    // отправляем эти сoords куда-нибудь по аякс
}

in which they are already sent somewhere, for example, via Ajax.

C
Codebaker, 2020-12-02
@Codebaker

The Geocoder API in the response will contain an Address object. Examples are right there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question