На сайте есть 2 системы карт яндекс и гугл!
вот код для яндекса
class Service_Map_YandexMaps extends Service_Map_Maps {
private function getInitScript($containerDOMName, $setCenter = true) {
$script =
'map = new YMaps.Map(document.getEle
map.addControl(new YMaps.Zoom());
map.addControl(new YMaps.ScaleLine());
map.addControl(new YMaps.MiniMap());
map.addControl(new YMaps.ToolBar());
map.addControl(new YMaps.TypeControl());
map.setMinZoom(12);
';
if ($this->traffic) {
$script .=
'YMaps.load("traffic", function() {map.addControl(new YMaps.Traffic.Control());});
';
}
if ($setCenter) {
$script .=
'map.setCenter(new YMaps.GeoPoint('.$this->mapCoords['centerLng'].', '.$this->mapCoords['centerLat'].'), '.$this->mapCoords['initZoom'].');
';
}
return $script;
}
private function getShowAddressScript() {
$script =
'function showAddress (value) {
var bounds = new YMaps.GeoBounds(
new YMaps.GeoPoint('.$this->m
new YMaps.GeoPoint('.$this->m
var geocoder = new YMaps.Geocoder(value, {boundedBy: bounds, strictBounds: true, '.($this->lang?'prefLang: "'.$this->lang.'"':'').'});
YMaps.Events.observe(geocoder, geocoder.Events.Load, function () {
if (this.length()) {
for (var i = this.length() - 1; i >= 0; i--) {
map.addOverlay(this.get(i));
if (i == 0) {
map.panTo(this.get(i).getGeoPoint());
this.get(i).setBalloonContent(this.get(i).text);
this.get(i).openBalloon();
}
}
} else {
alert("Ничего не найдено");
}
});
YMaps.Events.observe(geocoder, geocoder.Events.Fault, function (error) { alert("Произошла ошибка: " + error.message); });
}
';
return $script;
}
public function __construct($map_config) {
parent::__construct($map_config);
$this->nameService = 'Yandex Maps';
$this->APIScriptLocation = 'http://api-maps.yandex.ru
$this->traffic = $map_config->traffic;
$this->lang = $map_config->lang;
}
public function getDefaultMapPageScript($containerDOMName, $searchInputDOMName) {
$script =
'var map;
window.onload = function () {
'
.$this->getInitScript($containerDOMName).
'}
window.onunload = function() {
map.destructor();
}
'
.$this->getShowAddressScript().
'
function showAddressExample(value) {
$("#'.$searchInputDOMName.'").val(value);
map.removeAllOverlays();
showAddress(value);
}
function showSubcatMarkers(subcat_id, subcat_name) {
if (map) {
$.post("/map/showcatalogonmap", {subcat:subcat_id}, function(data) {
$("span#kroshkiSubcatName").html(" / "+subcat_name);
$("span#h1Subcatname").html(" / "+subcat_name);
ShowMarkers(data);
}, "json");
}
}
function showCatMarkers(cat_id, cat_name) {
if (map) {
$.post("/map/showcatalogonmap", {cat:cat_id}, function(data) {
$("span#kroshkiSubcatName").html(" / "+cat_name);
$("span#h1Subcatname").html(" / "+cat_name);
ShowMarkers(data);
}, "json");
}
}
function ShowMarkers(data) {
map.removeAllOverlays();
for (var i = 0; i < data.length; i++) {
var s = new YMaps.Style();
s.iconStyle = new YMaps.IconStyle();
s.iconStyle.href = data[i].map_icon;
s.iconStyle.size = new YMaps.Point(22, 30);
s.iconStyle.offset = new YMaps.Point(-5, -30);
var placemark = new YMaps.Placemark(new YMaps.GeoPoint(data[i].geo_coord_lng, data[i].geo_coord_lat), {style: s});
baloonHtml = "<table style=\"max-width:300px;\"><tr><td><img src=\"/upload/img/catalog/logos/small/" +
data[i].logo +
"\" width=\"50px\" border=\"0\" /></td><td style=\"padding-left: 5px;\"><a href=\"/catalog/full/" +
data[i].id +
"\">" +
data[i].firmname +
"</a><br/>" +
data[i].adress +
"</td></tr></table>";
placemark.setBalloonContent(baloonHtml);
map.addOverlay(placemark);
}
}';
return $script;
}
public function getShowonmapPageScript($containerDOMName, $addresses) {
$script =
'var map, markers;
window.onload = function () {
var wH = document.documentElement.clientHeight - 20;
document.getElementById("
';
//Zend_Debug::dump($addresses);
$script .=
'markers = [';
$i = array();
foreach ($addresses as $address) {
$i[] = '
["'.$address['geo_coord_l
}
$script .= implode(',', $i);
$script .= '
];';
$script .= '
'
.$this->getInitScript($containerDOMName, false);
foreach ($addresses as $address) {
if (!empty($address['geo_coord_lng']) && !empty($address['geo_coord_lat'])) {
$script .= '
var placemark = new YMaps.Placemark(new YMaps.GeoPoint('.$address
draggable: false,
hasBalloon: false
});
placemark.setIconContent(
map.addOverlay(placemark);';
}
}
if (!empty($addresses[0]['geo_coord_lng']) && !empty($addresses[0]['geo_coord_lat'])) {
$script .=
'
map.setCenter(new YMaps.GeoPoint('.$address
';
} else {
$script .=
'placeOnCenter(markers[0]);
';
}
$script .=
'}
window.onunload = function() {
map.destructor();
}
function placeOnCenter(marker) {
if ("" == marker[0] || "" == marker[1]) {
showAddress(marker[3]);
} else {
map.panTo(new YMaps.GeoPoint(marker[0], marker[1]));
}
}
';
$script .= $this->getShowAddressScript();
return $script;
}
public function getShowonmapAddressPageScript($containerDOMName, $address) {
$script =
'var map, geoResult;
window.onload = function () {
var wH = document.documentElement.clientHeight - 20;
document.getElementById("
'
.$this->getInitScript($containerDOMName).
'
showAddress("'.$address.'");
}
window.onunload = function() {
map.destructor();
}
'.$this->getShowAddressScript();
return $script;
}
public function getAdminListPageScript($containerDOMName, $markers) {
$script =
'var map;
window.onload = function () {
'
.$this->getInitScript($containerDOMName).
'
';
foreach ($markers as $_marker) {
if (!empty($_marker['geo_coord_lat']) && !(empty($_marker['geo_coord_lng']))) {
$script .=
'placemark = new YMaps.Placemark(new YMaps.GeoPoint('.$_marker
draggable: false,
hasBalloon: false
});
placemark.setIconContent(
map.addOverlay(placemark);
';
}
}
$script .=
'};
window.onunload = function() {
map.destructor();
};
'.$this->getShowAddressScript();
return $script;
}
public function getAdminEditPageScript($containerDOMName, $marker) {
$script =
'var map;
window.onload = function () {
map = new YMaps.Map(document.getEle
map.setMinZoom(12);
map.addControl(new YMaps.Zoom());
map.addControl(new YMaps.ScaleLine());
map.addControl(new YMaps.MiniMap());
map.addControl(new YMaps.ToolBar());
map.setCenter(new YMaps.GeoPoint('.$this->mapCoords['centerLng'].', '.$this->mapCoords['centerLat'].'), 12);
var placemark = new YMaps.Placemark(new YMaps.GeoPoint('.$marker[
draggable: true,
hasBalloon: false
});
placemark.setIconContent(
map.addOverlay(placemark);
YMaps.Events.observe(placemark, placemark.Events.DragEnd, function (mEvent) {
document.getElementById("geo_coord_lat").value = mEvent.getGeoPoint().getLat();
document.getElementById("geo_coord_lng").value = mEvent.getGeoPoint().getLng();
});
}
window.onunload = function() {
map.destructor();
}
'.$this->getShowAddressScript();
return $script;
}
}
Вот код настроек
// Карта города
'map' => array (
'provider' => 'yandex',
//'provider' => 'google',
'key_api' => array(
'yandex' => 'AAxLDlIBAAAAFaoxEAIAzg01
'google' => 'ABQIAAAAI1J5iOTYWuF58wEo
),
'initZoom' => '13',
//географические координаты центра города 44.515942,48.707793
'mapCenterLat' => '48.707793', // - широта
'mapCenterLng' => '44.515942', // - долгота
// Долгота: 28°35′22.92″E (28.589701)
// Широта: 49°53′41.94″N (49.894983)
//географические координаты прямоугольной области, которой будет ограничена функция поиска
/// 44.195965,48.96254
//44.819439,48.519298
'searchRectLeftBottomLat' => '48.96254',
'searchRectLeftBottomLng' => '44.195965',
'searchRectRightTopLat' => '48.519298',
'searchRectRightTopLng' => '44.819439',
'traffic' => true,
'office_on_map' => 'ул. Рокосовского 1',
'address_in_map_text' => 'дом 1 по улице Рокосовского'
),
как можно изменить схему на народную карту????
апи 1.х