1
나는 내가 지금까지 그렇게하고있어 데이터베이스센터에서 Google Map on point?
function getMarkers(){
var urlstr="readsingle.php?v=<?php echo $cam ?>";
var request = GXmlHttp.create();
request.open('GET', urlstr , true); // request XML from PHP with AJAX call
request.onreadystatechange = function() {
if (request.readyState == 4) { // 4 is a completed request
var xmlDoc = request.responseXML;
locations = xmlDoc.documentElement.getElementsByTagName("location");
markers = [];
if (locations.length){
for (var i = 0; i < locations.length; i++) { // cycle thru locations
markers[i] = new GMarker(new GLatLng(locations[i].getAttribute("lat"),locations[i].getAttribute("lng")));
markers[i].infowindow = "This is "+locations[i].getAttribute("name");
markers[i].markerindex = i;
markers[i].db_id = locations[i].getAttribute("location_id");
map.addOverlay(markers[i]);
}
}
}
}
request.send(null);
}
에서 단일 마커이 함수를 얻기 위해이 기능을 사용하고, 데이터베이스에서 가져온 단일 마커에 구글지도의 중심을 시도하고있다 나는이 라인
map.setCenter(new GLatLng(53.76, -2.71), 5);
단일 마커의 위도 LNG 값을 일치하도록에 위도 LNG 값을 변경할 수있는 방법지도
function onLoad() {
map = new GMap(document.getElementById("div_map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(53.76221, -2.71227), 8);
map.enableScrollWheelZoom();
getMarkers();
GEvent.addListener(map, "click", function(overlay, point) {
if (overlay){ // marker clicked
overlay.openInfoWindowHtml(overlay.infowindow); // open InfoWindow
} else if (point) { // background clicked
}
});
}
로드? 또는 데이터베이스에서 단일 마커를 가져 와서 맵을 중앙에 배치하는 더 간단한 방법이 있습니까?
map.setCenter(new GLatLng(locations[i].getAttribute("lat"),
locations[i].getAttribute("lng")), 5);
를 한 후 또는지도에 마커를 추가하기 전에 : getMarkers()
이 하나 개의 마커를 검색하는 경우 간단하게 추가 할 수 있습니다 같은
건배, 몰랐어요 getmarkers 함수 내에서 설정할 수 있습니다. – FozzDog