I am getting the above error on my HTML file @ line number 22. I tried several attempts and was unable to resolve it.
Here is the HTML code:
Web-Map
The .js code looks like this
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
/*specifying the extent of the map*/
var extents = new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34);
/*loading various controls to the map*/
var control, controls = [];
var map = new OpenLayers.Map("map" /*this map is the div id in the html code*/, {
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.ArgParser(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('dropdown-content')}),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.ScaleLine(),
//new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Zoom(),
new OpenLayers.Control.KeyboardDefaults()
],
maxExtent: extents,
minExtent: "auto",
restrictedExtent: extents /*one cannot pan outside the specified extent*/
},
{projection: new OpenLayers.Projection("EPSG:900913")}, /*specifying the projection*/
//{displayProjection: new OpenLayers.Projection("EPSG:4326")},
//maxResolution: 156543.0339,
{units: 'm'},
{allOverlays: true} /*all other data added will overlay on the basemap*/
);
function init (){
//var google_sat = new OpenLayers.Layer.Google("Google Satellite",{type:google.maps.MapTypeId.SATELLITE,numZoomLevels:40});
var OSM = new OpenLayers.Layer.OSM("OpenStreetMap"); /*loading the OSM basemap*/
/*loading the overlays from GeoServer.web_map is the workspace name. Loading the layer as a WMS*/
var Boundary = new OpenLayers.Layer.WMS (
"Boundary",
"http://localhost:8080/geoserver/wms",
{layers:":Boundary",transparent: true, EPSG:4326, format: "image/gif"},
{visibility: true},
{'displayInLayerSwitcher':true}
);
var Ext = new OpenLayers.Layer.WMS (
"Ext",
"http://localhost:8080/geoserver/wms",
{layers:":Ext",transparent: true, EPSG:4326, format: "image/gif"},
{visibility: false},
{'displayInLayerSwitcher':true}
);
var Erv = new OpenLayers.Layer.WMS (
"Zonning",
"http://localhost:8080/geoserver/wms",
{layers:":Erv",transparent: true, EPSG:4326, format: "image/gif"},
{visibility: false},
{'displayInLayerSwitcher':true}
);
var Parcels = new OpenLayers.Layer.WMS (
"Parcels",
"http://localhost:8080/geoserver/wms",
{layers:":Parcels",transparent: true, EPSG:4326, format: "image/gif"},
{visibility: false},
{'displayInLayerSwitcher':true}
);
/*adding the data to the map object*/
map.addLayers([OSM,Boundary,Ext,Erv,Parcels,]);
/*specifying the center of the map and a zoom level of 3*/
map.setCenter(new OpenLayers.LonLat(15.7832786675738,-22.0109820763529),3);
var zoom = 5;
//var map;
var infoControls;
var highlightlayer;
var aktLayer=-1;
// pink tile avoidance
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
// make OL compute scale according to WMS spec
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
infoControls = {
click: new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost:8080/geoserver/Karibib/wms',
title: 'Identify features by clicking',
layers: [Boundary,Ext_Boundaries,Erv,Parcels],
queryVisible: true,
infoFormat:'application/vnd.ogc.gml',
eventListeners: {
getfeatureinfo: function(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
GenPopText(event),
null,
true
));
}}
}),
hover: new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost:8080/geoserver/wms',
title: 'Identify features by clicking',
layers: [Boundary,Ext,Erv,Parcels],
hover: true,
// defining a custom format options here
formatOptions: {
typeName: 'water_bodies',
featureNS: 'http://www.openplans.org/topp'
},
queryVisible: true,
infoFormat:'text/html'
})
};
for (var i in infoControls) {
infoControls[i].events.register("getfeatureinfo", this, showInfo);
map.addControl(infoControls[i]);
}
infoControls.click.activate();
//infoControls.hover.activate();
// Active layer combo
populateLayer(0);
}
}
// sets the HTML provided into the nodelist element
function setHTML(response){
document.getElementById('nodelist').innerHTML = response.responseText;
};
function errorHTML(response)
{
alert("req erro:" + response.responseText);
}
function showInfo(evt) {
if (evt.features && evt.features.length) {
highlightLayer.destroyFeatures();
highlightLayer.addFeatures(evt.features);
highlightLayer.redraw();
$('nodelist').innerHTML = GenPopText(evt);
} else {
$('nodelist').innerHTML = evt.text;
}
}
function GenPopText(evt){
var temstr="" + evt.features[0].gml.featureType + "
";
for(var key in evt.features[0].attributes)
{
temstr += "" + key + ":" + evt.features[0].attributes[key] + "
";
}
return temstr
};
No comments:
Post a Comment