[Users] Problem about google multi-based layers

Peerasak Wangsom pwangsom at gmail.com
Sun Jun 5 07:22:44 CEST 2011


Dear All,

I'm a beginner for javascript, OpenLayers, ExtJS and GeoExt.
I'm developing a web map with multi-based layers from google.
However, when I used the following code, there is the white layer over the
google based layer after the map is rendered.
How could I solve this problem? I also attached the full code.

Thank in advanced.

Wangsom


    var mapOptions = {
        controls: [
        new OpenLayers.Control.Navigation(),
        new OpenLayers.Control.PanZoomBar(),
        new OpenLayers.Control.ScaleLine(),
        new OpenLayers.Control.KeyboardDefaults()
        ],
        allOverlays: false,
        projection: "EPSG:900913",
        units: 'm'
    };

    var map = new OpenLayers.Map('map', mapOptions);

    var gmap = new OpenLayers.Layer.Google(
        "Google Map", // the default
        {
            type: google.maps.MapTypeId.ROADMAP,
            numZoomLevels: 20
        }, {
            isBaseLayer: true,
            buffer: 0,
            visibility: false
        }
        );

    var gsat = new OpenLayers.Layer.Google(
        "Google Satellite",
        {
            type: google.maps.MapTypeId.SATELLITE,
            numZoomLevels: 22
        }, {
            isBaseLayer: true,
            buffer: 0,
            visibility: false
        }
        );

    var gphy = new OpenLayers.Layer.Google(
        "Google Terrain",
        {
            type: google.maps.MapTypeId.TERRAIN,
            numZoomLevels: 22
        }, {
            isBaseLayer: true,
            buffer: 0,
            visibility: false
        }
        );

    var ghyb = new OpenLayers.Layer.Google(
        "Google Hybrid",
        {
            type: google.maps.MapTypeId.HYBRID,
            numZoomLevels: 22
        }, {
            isBaseLayer: true,
            buffer: 0,
            visibility: false
        }
        );

    var boundary = new OpenLayers.Layer.WMS("Tasmania State Boundaries",
        localUrl, {
            layers: "topp:tasmania_state_boundaries",
            transparent: true,
            format: "image/png"
        }, {
            isBaseLayer: false,
            opacity: 0.2,
            visibility: true,
            buffer: 0,
            displayOutsideMaxExtent: true
        });

    var water =  new OpenLayers.Layer.WMS("Water",
        localUrl, {
            layers: "topp:tasmania_water_bodies",
            transparent: true,
            format: "image/png"
        }, {
            isBaseLayer: false,
            visibility: true,
            buffer: 0,
            displayOutsideMaxExtent: true
        });

    var city = new OpenLayers.Layer.WMS("Cities",
        localUrl, {
            layers: "topp:tasmania_cities",
            transparent: true,
            format: "image/png"
        }, {
            isBaseLayer: false,
            visibility: true,
            buffer: 0,
            displayOutsideMaxExtent: true
        });

    var road = new OpenLayers.Layer.WMS("Tasmania Roads",
        localUrl, {
            layers: "topp:tasmania_roads",
            transparent: true,
            format: "image/png"
        }, {
            isBaseLayer: false,
            visibility: true,
            buffer: 0,
            displayOutsideMaxExtent: true
        });

    map.addLayers([ghyb, gsat, gphy, gmap, boundary, water, city, road]);

    var mapPanel = new GeoExt.MapPanel({
        map: map,
        center: new OpenLayers.LonLat(146.64681, -42.16430).transform(
            new OpenLayers.Projection("EPSG:4326"),
            map.getProjectionObject()),
        zoom: 7,
        region: "center",
        layout: "fit"
    });
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110605/194deca2/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: google-multi-base.js
Type: application/x-javascript
Size: 5277 bytes
Desc: not available
Url : http://www.geoext.org/pipermail/users/attachments/20110605/194deca2/attachment.js 


More information about the Users mailing list