E
E
Egor Ogurtsov2015-02-08 02:36:57
JavaScript
Egor Ogurtsov, 2015-02-08 02:36:57

How to convert addresses to coordinates?

There is an excel table with addresses in the form:
Shop #1 | Moscow, Nikolskaya, st. Nikolskaya, 17, building 1
Shop #2 | Moscow, shopping center Tramplin, st. Yartsevskaya, 25a

How to convert these addresses into coordinates for Yandex maps (for use with json ObjectManager)?
Or how else can these addresses be used when displaying hundreds of markers on a map?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2015-02-08
@mrdubz

In PHP it goes something like this

$addr = urlencode( $address);
$xml = file_get_contents( "http://geocode-maps.yandex.ru/1.x/?geocode=$addr&results=1" );
// print $xml; Можете посмотреть выдачу 
preg_match( '/<pos>([^<]*)<\/pos>/', $xml, $match );
preg_match( '/<precision>([^<]*)<\/precision>/', $xml, $prec );
if ( isset($prec[1]) && isset( $match[1] ) && $prec[1] =='exact' )
  return explode( ' ', $match[1] );

Well, read all the details in the documentation
https://tech.yandex.ru/maps/doc/geocoder/desc/conc...
Excel file can be pre-converted to CSV

I
IceJOKER, 2015-02-08
@IceJOKER

"yandex geocoder" - this query in a search engine should help you find the answer you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question