I have latitude and longitude - how can I get the name of the street and district?
(data obtained using html5 navigator.geolocation.getCurrentPosition )
I have latitude and longitude - how can I get the name of the street and district?
(data obtained using html5 navigator.geolocation.getCurrentPosition )
Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
In the API query string, replace <longitude> and <latitude> with the appropriate values.
https://geocode-maps.yandex.ru/1.x/?&geocode=E<долгота>,N<широта> In response, you will receive xml, where the address is specified in GeocoderMetaData.
For example, for 30.316785 and 59.926353, a query such
https://geocode-maps.yandex.ru/1.x/?&geocode=E30.316785,N59.926353 In response, we get xml with the address: Russia, St. Petersburg, Sennaya Square.
The description of API request parameters is here .
You can get the value of <longitude> and <latitude> at https://maps.yandex.ru
To do this, select a point on the map, in the context menu you need to select "what is here?" and in the panel on the right, look at the value of longitude and latitude.
< and > it is not necessary to specify. added an example in response - StackThe answer given by @Stack relates to yandex-maps-api . However, you also have google-maps-api in the tags, so let me answer about google.
So, the principle is the same as in Yandex: in the address bar (or using curl ) you call the address
https://maps.googleapis.com/maps/api/geocode/json?latlng=<широта>,<долгота>&language=ru In the answer we will receive JSON object with the most available data.
For your example it would be like this: https://maps.googleapis.com/maps/api/geocode/json?latlng=59.926353,30.316785&language=ru
And it gives the address down to the house number. Of course, such accuracy is not always possible ...
Remarks:
/json? on /xml? , the refund will be in xml format.language attribute is optional. If you specify it - the answer will contain the names in Russian. If you do not specify it - the names will be mostly in EnglishSource: https://ru.stackoverflow.com/questions/485325/
All Articles