Olá Pessoal,<div>Eu nao estou conseguindo mostrar o mapa quando adiciono o layer google satelitte. Sem ele tudo fucniona.</div><div>Alguem por favor poderia me ajudar?</div><div>O codigo fonte segue abaixo..</div><div><br>
</div><div>Obrigado.</div><div><br></div><div>Ney</div><div><br></div><div><br></div><div><br></div><div><div><html></div><div><head></div><div><!-- OpenLayers core js --></div><div><script</div><div>
src="<a href="http://www.openlayers.org/dev/OpenLayers.js">http://www.openlayers.org/dev/OpenLayers.js</a>"></script></div><div> </div><div><!-- OpenStreetMap base layer js --></div><div><script</div>
<div>src="<a href="http://www.openstreetmap.org/openlayers/OpenStreetMap.js">http://www.openstreetmap.org/openlayers/OpenStreetMap.js</a>"></div><div></script></div><div> </div><div><!-- Google Maps --></div>
<div><script src="<a href="http://maps.google.com/maps/api/js?sensor=false">http://maps.google.com/maps/api/js?sensor=false</a>"></div><div></script></div><div> </div><div><script type="text/javascript"></div>
<div>function init() {</div><div>//set up projections</div><div> </div><div>// World Geodetic System 1984 projection</div><div>var WGS84 = new OpenLayers.Projection("EPSG:4326");</div><div> </div><div>// WGS84 Google Mercator projection</div>
<div>var WGS84_google_mercator = new OpenLayers.Projection("EPSG:900913");</div><div> </div><div>//Initialize the map</div><div>//creates a new openlayers map in the <div> html element id map</div><div>var map = new OpenLayers.Map ("map", {</div>
<div>controls:[</div><div>//allows the user pan ability</div><div>new OpenLayers.Control.Navigation(),</div><div>//displays the pan/zoom tools</div><div>new OpenLayers.Control.PanZoom(),</div><div>//displays a layer switcher</div>
<div>new OpenLayers.Control.LayerSwitcher(),</div><div>//displays the mouse position's coordinates in a <div> html element with</div><div>new OpenLayers.Control.MousePosition({</div><div>div:document.getElementById("coordinates")</div>
<div>})</div><div>],</div><div>projection: WGS84_google_mercator,</div><div>displayProjection: WGS84</div><div>} );</div><div> </div><div>//base layers</div><div>var openstreetmap = new OpenLayers.Layer.OSM();</div><div>var google_maps = new OpenLayers.Layer.Google(</div>
<div>"Google Maps", {</div><div>numZoomLevels: 20</div><div>}</div><div>);</div><div>var google_satellite = new OpenLayers.Layer.Google(</div><div>"Google Satellite", {</div><div>type: google.maps.MapTypeId.SATELLITE,</div>
<div>numZoomLevels: 20</div><div>}</div><div>);</div><div> </div><div>var wms_layer = new OpenLayers.Layer.WMS(</div><div> "Blocks",</div><div> "<a href="http://localhost:9999/geoserver/wms">http://localhost:9999/geoserver/wms</a>",</div>
<div> {layers: "_comp",</div><div> transparent: true,</div><div> srs: "EPSG:26918",</div><div> });</div><div><br></div>
<div>map.addLayers([openstreetmap, google_maps, google_satellite, wms_layer]);</div><div><br></div><div> </div><div>// map extent</div><div>var mapextent = new OpenLayers.Bounds(-123.17341, 49.24343, -123.06183, 49.29899).transform(WGS84, map.getProjectionObject());</div>
<div>map.zoomToExtent(mapextent);</div><div>}</div><div></script></div><div></head></div><div><body onload="init()"></div><div><div id="map" style="width:500px; height:500px;"></div></div>
<div><div id="coordinates"></div></div><div></body></div><div></html></div></div><div><br></div>