Hi all,
I created a map with wms and openlayers and it was working well before, but now it is not working. I don't know what happened. I think openleyers chenged some stuff. But I don't really know what they changed. Can someone tell me what I have to change on my html?
My map is this;
<!-- MapServer Template -->
<html>
<head>
<DIV id="nodeList" STYLE="position:absolute; TOP:400px; LEFT:900px;" border=1 bgcolor="White"></DIV>
<div id="paneldiv" class="olControlNavToolbar" STYLE="position:absolute; TOP:295px; LEFT:720px;"></div>
<div id="layerswitcher" STYLE="position:absolute; background-color:#FFDEAD; TOP:60px; LEFT:720px;"></div>
<!--<div id="layerswitcher" class="olControlLayerSwitcher" STYLE="position:absolute; TOP:55px; LEFT:720px;"></div>To make panel-->
<style type="text/css">
#map {
width: 700;
height: 700px;
border: 1px solid gray;
}
</style>
<link rel="stylesheet" href="../OpenLayers/theme/default/style.css" type="text/css" />
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript" src="../OpenLayers/OpenLayers.js"></script>
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
<script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<!--this is the start of the javascript code which is used to create the map-->
<script type="text/javascript">
var map;
// avoid pink tiles
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.Util.onImageLoadErrorColor = "transparent";
function init(){
var extent = new OpenLayers.Bounds(
-10715879.60365,
5157399.28796,
-8250326.81962,
7808846.92475
);
var options = {
projection: "EPSG:900913",
units: "m",
maxResolution: 'auto',
maxExtent: extent
};
//var options = {
//projection: "EPSG:900913", units: "m", maxResolution: 'auto',
//maxExtent: new OpenLayers.Bounds( -12361775.356449,5047422.082970,-6506591.670628,7796850.936193)};
map = new OpenLayers.Map('map', options);
// create Google Mercator layers
var gmap = new OpenLayers.Layer.Google( "Google Streets", {'sphericalMercator': true}
);
var gsat = new OpenLayers.Layer.Google( "Google Sattelite", {type: G_SATELLITE_MAP, 'sphericalMercator': true}
);
var ghyb = new OpenLayers.Layer.Google( "Google Hybrid", {type: G_HYBRID_MAP, 'sphericalMercator': true}
);
var gphy = new OpenLayers.Layer.Google( "Google Physical", {type: G_PHYSICAL_MAP, 'sphericalMercator': true}
);
//var gearth = new OpenLayers.Layer.Google( "Google Earth", {type: G_SATELLITE_3D_MAP, 'sphericalMercator': true} );
var yahoosat = new OpenLayers.Layer.Yahoo(
"Yahoo Satellite",
{'type': YAHOO_MAP_SAT, sphericalMercator: true}
);
// create WMS layer
var wms = new OpenLayers.Layer.WMS( "ResidentGeologistDistrict_2011",
"http://localhost/cgi-bin/mapserv.exe?map=C:/wwwroot/Practice2/Practice.map",
{'layers': 'ResidentGeologistDistrict_2011', TRANSPARENT:'true','format':'png', projection:'EPSG:900913'},
{
'isBaseLayer': false,opacity: 0.4
});
var wms2 = new OpenLayers.Layer.WMS( "Drainage",
"http://localhost/cgi-bin/mapserv.exe?map=C:/wwwroot/Practice2/Practice.map",
{'layers': 'Drainage', TRANSPARENT:'true','format':'png', projection:'EPSG:900913'},
{
'isBaseLayer': false,opacity: 0.4
});
var wms3 = new OpenLayers.Layer.WMS( "LAKES",
"http://localhost/cgi-bin/mapserv.exe?map=C:/wwwroot/Practice2/Practice.map",
{'layers': 'LAKES', TRANSPARENT:'true','format':'png', projection:'EPSG:900913'},
{
'isBaseLayer': false,opacity: 0.4
});
var wms4 = new OpenLayers.Layer.WMS( "MDI_2011_GOLD",
"http://localhost/cgi-bin/mapserv.exe?map=C:/wwwroot/Practice2/Practice.map",
{'layers': 'MDI_2011_GOLD', TRANSPARENT:'true','format':'png', projection:'EPSG:900913'},
{
'isBaseLayer': false,opacity: 1
});
map.addLayers([gphy, gmap, gsat, ghyb, yahoosat, wms, wms2, wms3, wms4]);
wms4.setVisibility(false);
wms2.setVisibility(false);
var panel = new OpenLayers.Control.NavToolbar({'div':OpenLayers.Util.getElement('paneldiv')});
map.addControl(panel);
map.addControl(new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}));
//map.setCenter(new OpenLayers.LonLat(-12361775.356449,5047422.082970), 11);
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.Scale());
map.addControl(new OpenLayers.Control.Permalink());
//map.addControl(new OpenLayers.Control.Attribution());
map.addControl(new OpenLayers.Control.OverviewMap());
//map.addControl(new OpenLayers.Control.PanZoomBar());
map.zoomToMaxExtent()
map.events.register('click', map, function (e) {
OpenLayers.Util.getElement('nodeList').innerHTML = "Loading... please wait...";
var url = wms4.getFullRequestString({
REQUEST: "GetFeatureInfo",
EXCEPTIONS: "application/vnd.ogc.se_xml",
BBOX: wms4.map.getExtent().toBBOX(),
X: e.xy.x,
Y: e.xy.y,
INFO_FORMAT: 'text/html',
QUERY_LAYERS: wms4.params.LAYERS,
WIDTH: wms4.map.size.w,
HEIGHT: wms4.map.size.h});
OpenLayers.loadURL(url, '', this, setHTML);
OpenLayers.Event.stop(e);
});
}
function setHTML(response) {
OpenLayers.Util.getElement('nodeList').innerHTML = response.responseText;
}
function osm_getTileURL(bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
var z = this.map.getZoom();
var limit = Math.pow(2, z);
if (y < 0 || y >= limit) {
return OpenLayers.Util.getImagesLocation() + "404.png";
} else {
x = ((x % limit) + limit) % limit;
return this.url + z + "/" + x + "/" + y + "." + this.type;
}
}
</script>
</head>
<body onload="init()">
<h3>Mining Divisions</h3>
<div id="map"></div>
</body>
</html>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Openlayers-map-is-not-working-anymore-tp4984426.html">Openlayers map is not working anymore!!!</a><br/>
Sent from the <a href="http://osgeo-org.1560.n6.nabble.com/OpenLayers-Users-f3910695.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br/>