base layer on openlayers 2.13 not showing Google if set first choice

المشرف العام

Administrator
طاقم الإدارة
I am working a ol 2.13.1 & i have a strange issue.As base maps I have OSM & Google.

When I set as default Google it doesn't shows nothing. Only the OSM layer appears when selected.

BUT if i have the OSM as default then I switch between all base layers without issue.

var map = new OpenLayers.Map("map-id"); var format = 'image/png'; // pink tile avoidance OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5; // make OL compute scale according to WMS spec OpenLayers.DOTS_PER_INCH = 25.4 / 0.28; var googleMercator = new OpenLayers.Projection("EPSG:900913"); var wgs84 = new OpenLayers.Projection("EPSG:4326"); //base layer map = new OpenLayers.Map({ div: "map", units: "m", projection: googleMercator, displayProjection: wgs84 }); var mapBoxBackground = new OpenLayers.Layer.XYZ(" AWMC Background",["http://a.tiles.mapbox.com/v3/isawnyu.map-knmctlkh/${z}/${x}/${y}.png", "http://b.tiles.mapbox.com/v3/isawnyu.map-knmctlkh/${z}/${x}/${y}.png", "http://c.tiles.mapbox.com/v3/isawnyu.map-knmctlkh/${z}/${x}/${y}.png", "http://d.tiles.mapbox.com/v3/isawnyu.map-knmctlkh/${z}/${x}/${y}.png"], { attribution: "Tiles © MapBox | " + "Data © OpenStreetMap and contributors, CC-BY-SA |"+ " Tiles and Data © 2013 AWMC" + " CC-BY-NC 3.0", sphericalMercator: true, wrapDateLine: true, transitionEffect: "resize", buffer: 1, numZoomLevels: 13 } ); var google_var = new OpenLayers.Layer.Google( "Google LayerName", {type: google.maps.MapTypeId.BaseLayer} ); map.addControl(new OpenLayers.Control.LayerSwitcher()); var google_hybrid = new OpenLayers.Layer.Google( "Google Hybrid", {type: google.maps.MapTypeId.HYBRID} );so this is doensn't work

map.addLayers([google_var,google_terrain,mapBoxBackground,google_hybrid,google_physical]);but this works

map.addLayers([mapBoxBackground,google_var,google_terrain,google_hybrid,google_physical]);

أكثر...
 
أعلى