pre-release (May, 2003)
© Pedro Pereira Gonçalves (pedro@inovagis.org)

Project quickWMS: Generic JavaScript WMS Client
Example : Error Handling - multiple layer request example according to OpenGIS Web Mapping Specification using quickWMS class but where one of the url does not exists
Author : Pedro Pereira Gonçalves (pedro@inovagis.org)
Version : 0.01
Last Change : 2003-10-24
Tested on : Netscape 4.7, 7.0 and 7.1,
Mozilla 1.4.1, IE 5.5, IE 6.0, Camino 0.7(Mac-OS )






Source Code

    <script language='Javascript'>

    // WMS servers - list here other OGC compliant map servers
    // Changes: 2003-10-24 : Added http:// to the DEMIS and ESRIN server urls
    var demisWMS
    = "http://www.demis.nl/mapserver/request.asp";
    var esaWMS = "http://mapserv2.esrin.esa.it/cubestor/cubeserv/cubeserv.cgi";

    function writeMaps(){

    var map = new mapWMS(-180,-90,180,90);

    // events
    map.onError = function (layer){alert("Unable to load " + layer.caption + "\n from server " + layer.wmsUrl)}

    map.addLayer(esaWMS, "WORLD_MODIS_1KM:MapAdmin");
    map.addLayer(demisWMS, "Coastlines");

    // Lets set a error layer
    map.addLayer("http://nowhere.space", "WORLD", "1.0.0", "Test Layer");

    map.layers[0].format="JPEG";
    map.writeDOM("myMap", 350, 175, 350, 175, "background-color:white; border-style:solid; border-width:1; border-color:black;");
    map.toolbar = new toolBar(map);
    map.toolbar.writeDOM(350, 170, true);
    map.initialize();
    map.refresh();

    }
    writeMaps();
    </script>