I am about to teach an introductory course on GIS. One of the taught subjects is the OpenLayers library. Part of the course consists on exercises that the attendees will have to complete. Obviously, the very first OpenLayers exercise is creating a very simple map viewer.
Unexpectedly, I had problems with this simple example. The JavaScript code is shown below; the line causing the problem is highlighted:
// OpenLayers version: 2.10
function initMap() {
var WMS_SERVER = 'http://path/to/wms-server';
var map = new OpenLayers.Map('map', {
'projection': 'epsg:...',
'units': 'm',
'maxExtent': new OpenLayers.Bounds(..., ..., ..., ...),
'maxResolution': 'auto'
});
var layer = new OpenLayers.Layer.WMS('municipalities', WMS_SERVER, {
'layers': 'municipalities',
'format': 'image/png',
'transparent': true
});
map.addLayer(layer);
map.zoomToMaxExtent();
}
