嘿伙计们,我很难让我的谷歌地图使用自动变焦和自定义标记。在Google Chrome控制台中我得到了
too much recursion
...(0,0);Ba(T[I],function(){return"("+this.x+", "+this.y+")"});T[I].b=function(a){r...
main.js (ligne 24)
too much recursion
...nged")}var Lf={};function If(a){return Lf[a]||(Lf[a]=a[Bb](0,1).toUpperCase()+a[...
main.js (ligne 25)
main.js文件由Google托管http://maps.gstatic.com/intl/fr_ALL/mapfiles/api-3/10/19/main.js
我真的不明白这个问题
<?php
print ('
<script type="text/javascript">
$(function(){
var map;
var markersArray = [];
var image = \'img/\';
var bounds = new google.maps.LatLngBounds();
var loc;
var mapOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP };
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
');
$l=1;
foreach($carte as $value){
if ($carte[$l][lat]&&$carte[$l][lon]){
/*echo '
loc = new google.maps.LatLng("'.$carte[$l][lat].'","'.$carte[$l][lon].'");
bounds.extend(loc);
addMarker(loc, \'Event A\', "active");
';*/
echo '
loc = new google.maps.LatLng("'.$carte[$l][lat].'","'.$carte[$l][lon].'");
bounds.extend(loc);
addMarker(loc, \''.htmlentities($carte[$l][nom], ENT_QUOTES).str_replace('<br />', '', htmlentities($carte[$l][addresse], ENT_QUOTES)).'\', "active", "'.$l.'");
';
}
$l++;
}
print ('
map.fitBounds(bounds);
map.panToBounds(bounds);
function addMarker(location, name, active) {
var marker = new google.maps.Marker({
position: location,
map: map,
title: name,
status: active
});
}
});
</script>');
?>
我在这里做了一个小提琴 http://jsfiddle.net/KwayW/48/
此时任何帮助都会被贬低
答案 0 :(得分:4)
您有两个问题:
您正在将字符串传递到google.maps.LatLng constructor
该字符串表示中包含逗号而不是小数点
google.maps.LatLng
需要两个号码。
loc = new google.maps.LatLng("47,036084","-70,461227");
应该是:
loc = new google.maps.LatLng(47.036084,-70.461227);
BTW - 你所有的标记都在同一个位置......