86 lines
2.2 KiB
HTML
86 lines
2.2 KiB
HTML
#[body]#
|
|
<input id="address" name="address" type="text" style="font-size: 20px; margin: 10px 0px;" placeholder="Поиск адреса" tabindex="0"/>
|
|
<link href="https://cdn.jsdelivr.net/npm/suggestions-jquery@19.8.0/dist/css/suggestions.min.css" rel="stylesheet" />
|
|
<script src="https://cdn.jsdelivr.net/npm/suggestions-jquery@19.8.0/dist/js/jquery.suggestions.min.js"></script>
|
|
|
|
<script>
|
|
var mypm;
|
|
$("#address").suggestions({
|
|
token: "ccec8991a826fdb7832cc2db1be8098f8cce8759",
|
|
type: "ADDRESS",
|
|
deferRequestBy: 300,
|
|
minChars: 4,
|
|
triggerSelectOnEnter: true,
|
|
/* Вызывается, когда пользователь выбирает одну из подсказок */
|
|
onSelect: function(suggestion) {
|
|
|
|
|
|
if (mypm ) {
|
|
myMap.geoObjects.remove(mypm);
|
|
}
|
|
|
|
var lat = suggestion.data.geo_lat;
|
|
var lon = suggestion.data.geo_lon;
|
|
|
|
mypm = new ymaps.Placemark([lat,lon], {
|
|
hintContent: suggestion.unrestricted_value,
|
|
});
|
|
|
|
myMap.geoObjects.add(mypm);
|
|
myMap.setCenter([lat,lon], 16);
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script src="//api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
|
|
<div id="map" style="width: 100%; height: 600px; margin-bottom: 40px;"></div>
|
|
|
|
|
|
|
|
<script>
|
|
ymaps.ready(init);
|
|
|
|
var myMap;
|
|
var poligons = new Array();
|
|
|
|
function init() {
|
|
myMap = new ymaps.Map('map', {
|
|
center: [59.939027,30.314454],
|
|
zoom: 10,
|
|
controls: ['default']
|
|
});
|
|
myMap.controls.remove('searchControl');
|
|
{rows}
|
|
}
|
|
|
|
function dosearch() {
|
|
var str = $('#addr').val();
|
|
|
|
}
|
|
|
|
</script>
|
|
#[!body]#
|
|
|
|
|
|
#[row]#
|
|
myMap.geoObjects.add(
|
|
new ymaps.GeoObject({
|
|
geometry: {
|
|
type: "Polygon",
|
|
coordinates: {coords},
|
|
fillRule: "nonZero"
|
|
},
|
|
properties:{
|
|
hintContent: "{title}",
|
|
balloonContentHeader: '{title}',
|
|
balloonContentFooter: ''
|
|
}
|
|
}, {
|
|
fillColor: '{color}',
|
|
strokeColor: '#222',
|
|
opacity: 0.6,
|
|
strokeWidth: 1,
|
|
strokeStyle: 'solid'
|
|
})
|
|
);
|
|
#[!row]# |