내 Google지도에 표시 할 마커의 서버 끝 부분에 경계 기반 클러스터링을 구현하고 있습니다. 내가하고있는 일은지도가 움직이거나 이동하거나 확대되거나 맵의 경계를 차지하고 서버 쪽 스크립트가 간단한 sql 쿼리를 실행하여 아약스 호출을 호출 할 때마다 호출되는 함수가 있다는 것입니다. 마커 및 클러스터링합니다. 그래서 클러스터링 부분은 훌륭하게 작동하지만 때로 getBounds가 올바른 경계를 전송하지 않는 것 같습니다.Google지도 - 화면 이동 및 확대/축소 - 확대/축소시 표시되지 않는 마커 - 도움말!
마치 내가 마커를 사용했던 측면과 지역의 비트를 갑자기 움직일 수 있습니다. 이제 갑자기 마커가없고지도가 비어 있습니다. 난 SQL 쿼리를 확인하고 쿼리 자체에서 무엇보다 예상외로 다른 경계를 보여줍니다.
아래 지역에서보세요 : Orginal WitH Markers http://i31.tinypic.com/xds4t0.jpg No markers http://i31.tinypic.com/2r22ez4.jpg첫 번째는 모든 마커를 보여줍니다.
그러나 다음 중 하나는 조금 위쪽과 왼쪽으로 이동했지만 절반은 이전 그림과 동일하지만 마커가 전혀 없습니다. 맵의 getBounds 함수로 문제를 격리했습니다.
이 통화 경계를 취득하게 내 자바 스크립트 코드 :
$data = Zend_Json::decode(stripslashes($this->_request->getParam('object')));
//retrieve the variables from the GET vars
list($nelat, $nelng) = explode(',', $data['ne']);
list($swlat, $swlng) = explode(',',$data['sw']);
//clean the data
$nelng = (float)$nelng;
$swlng = (float)$swlng;
$nelat = (float)$nelat;
$swlat = (float)$swlat;
$ubound = $swlng > $nelng ? $swlng : $nelng;
$lbound = $swlng > $nelng ? $nelng : $swlng;
$sql = 'SELECT `a`.* FROM `locations` AS `a` WHERE (a.`longitude` > $lbound) AND (a.`longitude` < $ubound) AND';
$ubound = $swlat > $nelat ? $swlat : $nelat;
$lbound = $swlat > $nelat ? $nelat : $swlat;
$sql .= ' (a.`latitude` >= $lbound) AND (a.`latitude` <= $ubound)';
:이 좌표에 따라 항목을 얻기 위해 사용되는 PHP를 내 서버 측 코드에
var bounds = map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var data = {ne:northEast.toUrlValue(), sw:southWest.toUrlValue(), zoom:map.getZoom()};
//something getting messed up in the code above this point
$.ajax({
type: "POST",
url: 'maps/get-markers',
data: {object:$.toJSON(data)},
dataType: 'json',
success: function(response) {
//code to add markers
}
});
을
나는 getbounds 함수가 자바 스크립트에서 의심 스럽지만 최대한 빨리 수정해야합니다. 모든 아이디어를 당신이 당신을 설명했다 정확히 같은 방식으로 작동하는 페이지가
가 고정있어 - 내 모든 20 개 000 마커가 모든 응답에 대한 위치 :) 감사를 망쳐했다! – Ali