if building geo_point hr script ymaps ready function var center buildi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{% if building.geo_point %}
<hr>
<script>
ymaps.ready(function () {
var center = [{{ building.geo_point.x|formatted_float }}, {{ building.geo_point.y|formatted_float }}];
var itemMap = new ymaps.Map('map-item', {
center: center,
zoom: 16,
type: 'yandex#publicMap',
controls: ['rulerControl', 'zoomControl',]
});
PlacemarkItem = new ymaps.Placemark([{{ building.geo_point.x|formatted_float }}, {{ building.geo_point.y|formatted_float }}], {
hintContent: '{{ building.title }}<br>{{ building.adress }}'
}, {
iconLayout: 'default#image',
iconImageHref: '{{ STATIC_URL }}/images/home.png',
iconImageSize: [20, 32],
iconImageOffset: [-3, -42]
});
itemMap.geoObjects.add(PlacemarkItem)
})
</script>
<a name="watch-map"></a>
<div id="map-item"></div>{% endif %}