[OpenLayers-Users] Trouble getting feature info
Bistrais, Bob
Bob.Bistrais at maine.gov
Thu Dec 31 14:17:56 EST 2009
I am building a small application using a couple of WMS layers. I want
to include a feature info tool. I copied much of the code from the
example page,
http://openlayers.org/dev/examples/getfeatureinfo-control.html .
Without the line of code, infoControls.click.activate(); the map will
display. But if I include that line the map won't load. In Firebug the
following error occurs:
ActiveXObject is not defined 225var factory=null;if(typeof
GearsFactory!='undefined'){factory=new
GearsFactory();}else{try{factory=new ActiveXObject('Gears.Factory');
...(more follows, but it says the object is null).
One thing I'm not too sure of is if I have the proxy server correctly
configured.
If it helps, here is the code, minus the inline styles...
<html>
<head>
<title>OpenLayers test</title>
<script type="text/javascript" src="openlayers/OpenLayers.js">
</script>
<script defer="defer" type="text/javascript">.ProxyHost =
"proxy.php?url=";
var map, infocontrols;
function load() {
var mapOptions = { maxExtent: new OpenLayers.Bounds(316615,
4749552, 662100, 5266295),
: 'm',
:
'auto',
:
"EPSG:26919"
};
map = new OpenLayers.Map('map', mapOptions);
var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://myserver/wms/mapserv.exe?map=/wms/orthos.map&",
{ layers: 'naip2009,naip09_5m_overview,naip09_100m_overview',
transparent: 'false'}
);
var naipIndex = new OpenLayers.Layer.WMS(
"Index",
"http://myserver/wms/mapserv.exe?map=/ms4w/apps/orthoviewer/htdocs/Ortho
Viewer/OrthoViewer.map&",
{layers: 'NAIP2007 Imagery', transparent: 'true'}
);
highlightLayer = new OpenLayers.Layer.Vector("Highlighted
Features", {
displayInLayerSwitcher: false,
isBaseLayer: false
}
);
infoControls = {
click: new OpenLayers.Control.WMSGetFeatureInfo({
url:
'http://myserver/wms/mapserv.exe?map=/ms4w/apps/orthoviewer/htdocs/Ortho
Viewer/OrthoViewer.map',
title: 'Identify features by clicking',
layers: [naipIndex],
queryVisible: true
})
}
map.addLayers([wms,naipIndex,highlightLayer]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
infoControls.click.activate();
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="load()">
<p>OpenLayers Test Map</p>
<div style="width:100%; height:100%; border-right: blue thick
solid; border-top: blue thick solid; border-left: blue thick solid;
border-bottom: blue thick solid;" id="map"></div>
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091231/592ffcd9/attachment.html
More information about the Users
mailing list