M
M
MatrikLog2021-10-21 20:49:14
JavaScript
MatrikLog, 2021-10-21 20:49:14

How to get address from yandex map api geocoding?

Hello everyone, most likely I'm very stupid right now, but I need your help.
I am using get request on geocoding api from yandex map api

https://geocode-maps.yandex.ru/1.x/?apikey=58644385-f6c9-4932-8603-6756aa2d4314&geocode=56.751574,2038.573856

How can I get the Country, the city and the address from the body of the response?
The answer comes and everything is OK with it, but data is a string (and most likely even a json object, but this is not accurate)
How can I get the Country, city, address from data ?
The answer is:
{ config :".......",data:"..........",status:200.........}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DENIS Kokorev, 2021-10-22
@shmaroder

This is XML. It is possible through the regular season
https://regex101.com/r/7fM9C0/1/ - country
https://regex101.com/r/6mbe8V/1/ - as I understand the city (province)
https://regex101.com/r/ PxOys6/1/ - district (district)
https://regex101.com/r/L5v38u/1/ - street (street)
https://regex101.com/r/XKd3sD/1/ - house (house)
https:/ /regex101.com/r/km8N8a/1/ - complete address.
By analogy, you will understand further. Since the question is in the js section, press the codegenerator button and select javascript
https://regex101.com/r/km8N8a/1/codegen?language=j... will show the js code
6171de4277edf735220315.jpeg
And yes. Of course, strange coordinates - geocode=56.751574,2038.573856
Check, something is wrong here, IMHO.
Latitude and longitude are a pair of numbers (coordinates) used to describe position on the plane of a geographic coordinate system. Numbers are in decimal degrees and range from -90 to 90 for latitude and -180 to 180 for longitude.
6171e1dd70662882713071.jpeg
Yandex perceives 2038 as a street. Check the data.

F
freeExec, 2021-10-22
@freeExec

Add to request &format=jsonand get response in json

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question