나는 타일 ID를 사용하여 데이터베이스에 마커를 저장합니다.Google지도에서 getTile() 함수를 사용하는 적절한 방법
은
요청 너무 표시이 타일에 포함하는 모든 마커가되는 특정 타일을지도에 표시 될 때 그래서.
그래서 마침내 올바르게 작동하지 않는 코드가 생성되었습니다. 필요한 모든 것을 요청하지 않았습니다.
타일. 더 정확하게하려면지도를 이동할 때마다 하나의 타일 만 요청했습니다.
ServerFetchMapType.prototype.tileSize = new google.maps.Size(256,256);
ServerFetchMapType.prototype.maxZoom = 100;
ServerFetchMapType.prototype.name = "Server Tile #s";
ServerFetchMapType.prototype.alt = "Server Data Tile Map Type";
ServerFetchMapType.prototype.getTile = function(coord, zoom, ownerDocument){
if(zoom>10){
var tileId=this.getAddrLatLng(coord,zoom);
if(isTileAlreadyLoaded(tileId)){
return ;
}
ServerFetchedTiles[tileId] = true;
var url = "markerRequestPageJson.php?tileNumber=";
var json;
$.getJSON(url+tileId,function(json){
// this is where we can loop through the results in the json object
var _item;
var infoWindow = new google.maps.InfoWindow;
$.each(json, function(i,_item){
var point = new google.maps.LatLng(
parseFloat(_item.lat),
parseFloat(_item.lng));
var html = _item.id + "<br/>";
var marker = new google.maps.Marker({
map: map,
position: point
});
markerClusterer.addMarker(marker);
bindInfoWindow(marker, map, infoWindow, html);
});
});
}
return;
};
그러나 결국
내가 몇 가지 변경을하고 그것이 정상적으로 작동 : ServerFetchMapType.prototype.tileSize = new google.maps.Size(256,256);
ServerFetchMapType.prototype.maxZoom = 100;
ServerFetchMapType.prototype.name = "Server Tile #s";
ServerFetchMapType.prototype.alt = "Server Data Tile Map Type";
ServerFetchMapType.prototype.getTile = function(coord, zoom, ownerDocument){
if(zoom>10){
var tileId=this.getAddrLatLng(coord,zoom);
if(isTileAlreadyLoaded(tileId)){
return ;
}
ServerFetchedTiles[tileId] = true;
var div = ownerDocument.createElement('DIV');
var url = "markerRequestPageJson.php?tileNumber=";
var json;
$.getJSON(url+tileId,function(json){
// this is where we can loop through the results in the json object
var _item;
var infoWindow = new google.maps.InfoWindow;
$.each(json, function(i,_item){
var point = new google.maps.LatLng(
parseFloat(_item.lat),
parseFloat(_item.lng));
var html = _item.id + "<br/>";
var marker = new google.maps.Marker({
map: map,
position: point
});
markerClusterer.addMarker(marker);
bindInfoWindow(marker, map, infoWindow, html);
});
});
return div;
}
return;
};
내 질문 : 그것은 적절한 해결책인가?
여기에서 자세한 정보를 얻을 수 있습니다. http : //kashey.ru/maps/ajax-loading-as-tiles/ – knightOfSpring