I put yandex map (russian analogue of google map) on my view. In browser console (press F12) I see valud attitude and longtitude: x = 55,87103, y = 37,65851 - it is ok. Put baloon position on map is about (54,999994, -16,999978) coordinates - it is wrong! Here is the code:

<script type="text/javascript">
    ymaps.ready(init);
    var myMap,
        myPlacemark;

    function init() {
        myMap = new ymaps.Map("map", {
            center: [55.76, 37.64],
            zoom: 10
        });

        @foreach (var person in Model)
        {
            <text>
        console.log('Service = @person.ServiceName, x = @person.CoordinateX, y = @person.CoordinateY');

        myPlacemark = new ymaps.Placemark([@(person.CoordinateX), @(person.CoordinateY)], {
            hintContent: '@(person.ServiceName)',
            balloonContent: '@(person.CoordinateX), @(person.CoordinateY)'
        });
        myMap.geoObjects.add(myPlacemark);
            </text>
        }
    }
</script>

But if I change it to constants such way, everything is normal:

myPlacemark = new ymaps.Placemark([55.87103, 37,65851]...

I am newbie in javascript and suppose I miss some js tips. Please help me.

Related posts

Recent Viewed