S
S
sergeyfk2016-01-17 22:06:48
Yandex maps
sergeyfk, 2016-01-17 22:06:48

How to convert a string to coordinates?

the bottom line is that I get a string from the request (for my file). This string contains the coordinates as a string. I need to get the coordinates from this line (for example: '[55.751574, 37.573856]' or '55.751574, 37.573856').
here is the code

ymaps.ready(func);
               
               function func()
               {
            
               var x = new XMLHttpRequest();
            ymaps.ready(f);
               function f()
               {x.open("GET", "http://address/pos.php?login=DdyKNQ9FNQDnB9YifiY2&password=59FyAhtHt782KFninDZy", true);
x.onload = function (){
    
         map1.geoObjects.add(new ymaps.Placemark( x.responseText, {
            balloonContent: "Местоположение пользователя"
        }, {
            preset: "islands#circleDotIcon",
            iconColor: "#1faee9"
        }));
}
x.send(null);
             timerId01=setTimeout(function(){f();},10000);  }
               }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergeyfk, 2016-01-17
@sergeyfk

placemark is not shown because I'm giving coordinates in the wrong format. How to give them in the right format?

F
forgotten, 2016-01-17
@forgotten

Here is a good JavaScript tutorial: javascript.ru/book/definitiveguide

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question