M
M
massef2014-08-17 08:34:08
JavaScript
massef, 2014-08-17 08:34:08

Yandex maps, how to determine the user's location?

Hello.
There is a select with payment methods and a map with the nearest terminals, when you select one of the options, the map changes and the nearest terminals are displayed on it.
How to actually determine the user's location in Yandex maps?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Petrov, 2014-08-17
@massef

What Yandex does for you is the use of databases of IP addresses. Not all IPs have a binding to geographical objects (read the address). Whatever can be pulled out as much as possible, then Yandex also transmits to you.
Determining the position of a device is always a function that requires permission to act on the part of the owner of this device. This is how the Geolocation API works.
So make a request ( specification ) and pass the received coordinates to Yandex-maps. If the device is rarely moved, store the received response in localStorage.

D
Dmitry Entelis, 2014-08-17
@DmitriyEntelis

There is such a thing, but it's probably not what you need.
api.yandex.ru/maps/doc/jsapi/2.0/dg/concepts/geolo...
If we are talking about a mobile user, you can try to determine yourself
www.w3schools.com/html/html5_geolocation.asp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question