[OpenLayers-Users] Identifier working on Firefox, not IE7?
Xiaoyu Guan
guanxiaoyu at gmail.com
Tue Aug 19 03:49:17 EDT 2008
Dear All:
I use Geoserver + Tilecache + Openlayers. I have a identifier which only
work on Firefox. but on IE7 , not sure about IE6.
What I did, I have four Layers , two TileCache layers, two Geoserver layers.
I hide two geoserver layers in layerswitcher. People in the map viewer only
can get TileCache layers. I can use WMS getfeatureinfo from Geoserver. the
identifier is base on Geoserver. some poeple told me that IE and Firefox is
different when they reading an array. I have check my script for many times.
but still cannot figure it out. Is there anybody can help me to figure it
out?
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.FeatureInfo
*
* Inherits from:
* - <OpenLayers.Control>
*/
OpenLayers.Control.FeatureInfo = OpenLayers.Class(OpenLayers.Control, {
requestURL: null,
initialize: function(options) {
OpenLayers.Control.Panel.prototype.initialize.apply(this,
[options]);
},
destroy: function() {
this.map.events.unregister( 'click', this, this.getFeatureInfo );
OpenLayers.Control.prototype.destroy.apply(this, arguments);
},
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
return this.div;
},
activate: function() {
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {
this.map.events.register('click', this, this.getFeatureInfo);
return true;
}else{
return false;
}
},
deactivate: function() {
if (OpenLayers.Control.prototype.deactivate.apply(this, arguments))
{
this.map.events.unregister( 'click', this, this.getFeatureInfo
);
return true;
} else {
return false;
}
},
getFeatureInfo:function(evt){
if (!OpenLayers.Event.isLeftClick(evt)) return;
/* Here I removed two TileCache Layers from map.layers
Maybe the reason is I use slice
*/
var url = this.map.layers.slice(2)[0].getFullRequestString(
{
REQUEST: "GetFeatureInfo",
EXCEPTIONS: "application/vnd.ogc.se_xml",
BBOX:
this.map.layers.slice(2)[0].map.getExtent().toBBOX(),
X: evt.xy.x,
Y: evt.xy.y,
INFO_FORMAT: 'text/html',
QUERY_LAYERS:
this.map.layers.slice(2)[0].params.LAYERS,
FEATURE_COUNT: 50,
WIDTH: this.map.size.w,
HEIGHT: this.map.size.h
},
"http://127.0.0.1:2008/geoserver/wms"
);
OpenLayers.loadURL(url, '', this,
function(response) {
var lonlat = this.map.getLonLatFromViewPortPx(evt.xy);
var popup = new OpenLayers.Popup.AnchoredBubble(
" ",lonlat, null, response.responseText, null, true);
this.map.addPopup(popup, true );
});
OpenLayers.Event.stop(evt);
},
CLASS_NAME: "OpenLayers.Control.FeatureInfo"
});
Here is some related information about my script
http://www.nabble.com/TileCache-%2B-GetFeatureinfo(Geoserver1.6.4)--td18753089.html
All the best
Xiaoyu
--
Xiaoyu Guan (Sam)
Geo-information Science
Wageningen UR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080819/1dab63f1/attachment.html
More information about the Users
mailing list