[OpenLayers-Users] WMS layers and Gmaps V3 with OL 2.9.1

P Kishor punk.kish at gmail.com
Sun Aug 29 00:38:44 EDT 2010


I have the following, simplest possible code. Works without gmaps
layer, but no WMS shows up when gmaps layer is included. What is it
that I am doing wrong?

    <script type="text/javascript">
        function init(){
            var lon = -90.397;
            var lat = 45.93;
            var zoom = 5;
            var map = new OpenLayers.Map( 'map' );
            var layer = new OpenLayers.Layer.WMS(
                "OpenLayers WMS",
                "http://labs.metacarta.com/wms/vmap0",
                {layers: 'basic'}
            );

            var counties = new OpenLayers.Layer.WMS(
                "Counties",

"http://mapserv.ssec.wisc.edu/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/research/Projects/LakesTSI/lakestsi2.map",
                {
                    layers: "Counties",
                    map_imagetype: "agga",
                    transparent: true,
                    reproject: true,
                    singleTile: true
                }
            );

            var gphy = new OpenLayers.Layer.Google(
                "Google Physical",
                {type: google.maps.MapTypeId.TERRAIN}
            );

            // the following doesn't work
            map.addLayers([gphy, counties]);

            // the following works fine
            map.addLayers([layer, counties]);

            map.setCenter(new OpenLayers.LonLat(lon, lat).transform(
            	new OpenLayers.Projection("EPSG:4326"),
            	map.getProjectionObject()
        	), zoom);

            map.addControl( new OpenLayers.Control.LayerSwitcher() );
        }
    </script>

-- 
Puneet Kishor



More information about the Users mailing list