[OpenLayers-Users] Somebody can help me with setbaselayer?

lrocha leonel.rocha at altasur.com.uy
Thu Jun 19 19:21:31 EDT 2008


I need to set a new base layer acording to received parameter. The URL is as
follow:
http://localhost/track_mobile/viewer/tracking_onl.html?layers=roadup,google&blayer=Google
Roads

But the base layer always is ROADUP. The code is as follows:
.
.
    var mapGIS = new OpenLayers.Map('map', {
                                            controls: [], maxResolution:
'auto',
                                                eventListeners: {
                                                    "moveend": mapEvent,
                                                    "zoomend": mapEvent,
                                                    "changebaselayer":
mapBaseLayerChanged
                                                }
                                            });

    for(var i = 0; i < Args.layers.length; i++) {

        switch(Args.layers[i]) {
            case 'roadup':
                mapGIS.addLayer(
                  new OpenLayers.Layer.WMS( "RoadUP", 
                        "http://localhost:8080/geoserver/wms", 
                        {layers: 'TM_Mvdeo'}, {singleTile: true })
                  );

                break;

            case 'google':
                mapGIS.addLayers([
                    new OpenLayers.Layer.Google( "Google Roads" ), 
                    new OpenLayers.Layer.Google( "Google Satellite" , {type:
G_SATELLITE_MAP }),
                    new OpenLayers.Layer.Google( "Google Physical" , {type:
G_PHYSICAL_MAP }),
                    new OpenLayers.Layer.Google( "Google Hybrid" , {type:
G_HYBRID_MAP })]
                );
                break;
        }
        if (Args.layers[i] == Args.blayer) {
            var baseL = mapGIS.layers[i];
        }

    }

    mapGIS.setBaseLayer(baseL);
.
.


-- 
View this message in context: http://www.nabble.com/Somebody-can-help-me-with-setbaselayer--tp18019634p18019634.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list