[OpenLayers-Users] What is the function used to switch between GoogleMaps layers in OpenLayers ?

theog Bobosh23 at hotmail.com
Tue Jul 2 07:26:58 PDT 2013


Hi,

I am trying to use Google Maps' layers from Openlayers with this following
code :

map = new OpenLayers.Map('myMap', {
        projection: 'EPSG:3857',
        layers: [
            new OpenLayers.Layer.Google(
            	"Google Streets", // the default
            	{numZoomLevels: 20}
            ),
            new OpenLayers.Layer.Google(
                "Google Physical",
                {type: google.maps.MapTypeId.TERRAIN}
            ),
            new OpenLayers.Layer.Google(
                "Google Hybrid",
                {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
            ),
            new OpenLayers.Layer.Google(
                "Google Satellite",
                {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
            )
        ],
        center: new OpenLayers.LonLat(lon, lat)
            // Google.v3 uses web mercator as projection, so we have to
            // transform our coordinates
            .transform('EPSG:4326', 'EPSG:3857'),
        zoom: 5
    });
    map.addControl(new OpenLayers.Control.LayerSwitcher());

I am facing an issue in displaying the map even if I can interact with the
map as you can see :

<http://osgeo-org.1560.x6.nabble.com/file/n5063578/GoogleMapOpenLayersIssue.png> 

However, when I try to switch the layer, it works perfectly.
That's why I am asking this question :

What is the function used to switch between GoogleMaps layers in OpenLayers
? 
How does it work and what does it call ?

I would like to know how this function is made to use it at the beginning of
my initialization.
I watched in the structure of OpenLayers but I couldn't find it...

Regards,
Theo.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/What-is-the-function-used-to-switch-between-GoogleMaps-layers-in-OpenLayers-tp5063578.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list