저는 실제로 지금까지 해결할 수없는 큰 문제가 있습니다. 여기 내 문제가있다. 실제로 표시하거나 숨기려는 일부 범주에 따라 마커 (WMSGetFeatureInfo)를 표시하는지도가 있습니다.OpenLayers : 다중 레이어 팝업 문제
그러나 여기에 실제로 실제로 모든 마커가 포함 된 PNG 파일 인 * .map 파일로 해당 마커가 표시됩니다.
마커를 클릭하면 클릭 위치가 표시되고 팝업이 추가됩니다. 그러나지도에 표시되는 레이어가 많을수록 팝업이 관련 마커에서 멀리 떨어져 있습니다. 여기에 몇 가지 코드
:var layer = new OpenLayers.Layer.WMS(
category.label,
"/mapserv?Map=" + category.url,
{
layers : category.layer,
format : 'image/png',
version : '1.3.0',
srs : 'ESPG:3163'
},
{
isBaseLayer : false,
singleTile : true,
visibility : visibility,
}
);
var info = new OpenLayers.Control.WMSGetFeatureInfo({
title : 'get details by clicking',
layers : [ layer ],
infoFormat : "text/plain",
queryVisible : true,
eventListeners : {
getfeatureinfo : function(event){
document.body.style.cursor = 'auto';
var getId = function(text) {
result = context.settings.pattern.exec(text);
if(result == null) return;
return result[1];
}
var id = getId(event.text);
request = jQuery.ajax({
url : "/cartoweb/FicheTheme",
type : "get",
data : "idGeoEad="+id,
success : function(response, textStatus, jqXHR){
if (response == null || response['data'] == null) {
return;
}
context.generateAndShowPopup(event.xy, response['data']['metaData']);
}
});
},
beforegetfeatureinfo : function(event){
document.body.style.cursor = 'wait';
},
nogetfeatureinfo : function(event){
document.body.style.cursor = 'auto';
}
}
});
this.map.addControl(info);
info.activate();
generateAndShowPopup : function(latlong, text) {
var lonlatfrompx = this.map.getLonLatFromViewPortPx(latlong);
var anchor = {
'size' : new OpenLayers.Size(0,0),
'offset' : new OpenLayers.Pixel(-36, 6),
'keepInMap' : true
};
// Hide by default popup actually open
if(this.popup !== undefined) {
this.popup.hide();
}
// Create a new popup
this.popup = new OpenLayers.Popup.Anchored(
"chicken",
lonlatfrompx,
new OpenLayers.Size(2000, 2000),
'<div class="popupTail"></div><div class="popupContent">' + text + '</div>',
anchor,
false,
function(){}
);
// Popup settings
this.popup.setBackgroundColor('transparent');
this.popup.panMapIfOutOfView = true;
this.popup.calculateRelativePosition = function() { return 'tr'; }
// Add it on the map
this.map.addPopup(this.popup);
var that = this;
setTimeout(function(){
that.popup.updateSize();
}, 50);
this.map.setCenter(lonlatfrompx);
}
내가 뭔가 잘못하고있어 확실 아니지만 누군가가 이미 뭔가 잘못을했다 어디 있는지 정말 도움이 될 것 같은 문제에 직면합니다.
덕분에 많이 나는 레이어에 latlong을 재 투영하려고 노력했지만 여전히 작동하지 않도록
확인
편집 할 수 있습니다. 그러나, 나는 만들고있어 진행 :
// Layer is the layer associated to each WMSGetFeatureInfo
// this.layer is the base layer used to display the map
lonlatfrompx.transform(layer.projection, this.layer.projection);
this.map.setCenter(lonlatfrompx);
편집 내가 진행 상황을 만들고 있어요 그래서 1
좋아. 나는 문제가 어디서 왔는지 알고 있다고 생각하지만 아직도 어떻게 해결할 지 알지 못한다.
info
변수에 영향을 줄 때 클릭하면 팝업이 표시되는 아약스 호출이 생성됩니다. 이 레이어를 추가할수록 더 많은 정보를 얻으려고 애쓰하는 것입니다.
내가 5 개의 다른 레이어 (IT, 디자인, 시작, 컴퓨터 및 데스크톱)를 보여줍니다. 그런 다음 마커 (WMSGetFeatureInfo)를 클릭하면 실제적으로 아약스 request * [number of layers visible]
을 만든 다음 위치 값 (때때로)을 변경하려고 시도합니다.
이 문제를 해결하려면이 Ajax 요청이 두 번 이상 실행되지 않도록해야합니다. 어떤 아이디어?
감사합니다. 그 흥미 롭군요. 그러나 Openlayer의 초보자이기 때문에 무엇을 할 수 있습니까? 감사합니다 – lkartono
plz 내 업데이트를 참조하십시오 – JSC
안녕하세요, 감사합니다. URL이 WMS 서버'/ cartoweb/FicheTheme와 다른 이유로 아약스를 사용하고 있습니다.? idGeoEad ='. 실제 시스템은 데이터를 수집하는 서버를 기반으로하지 않으므로 마커와 관련된 정보를 되찾기 위해 ID가 포함 된 특정 URL을 쿼리해야합니다. 내가 알아챈 이상한 행동은 예를 들어 3 개의 레이어를 맵핑하면,'eventListeners : getfeatureinfo'가 3 번 실행되고 때로는 mulitple 값을 반환합니다. 그 순간에는 휴식을 취할 것입니다. 그러나'drillDown'을 사용하려고 시도했지만 아직 작동하지 않습니다. (생각. – lkartono