Overlay wms + google layer in Openlayers

المشرف العام

Administrator
طاقم الإدارة
I want to use OpenLayers, GeoServer layer with the google maps api as a base. In my GeoServer layer is redesigned to EPSG: 900913 when I open the geoserver openlayers with everything ok.



On a map created in OpenLayers projection EPSG: 900913 for working with the Google Maps API, then all my layers took this projection. Not forgetting that the GeoServer natively redesigns layer as configured above. Tested with alloverlay property to see where he was going to stop the WMS layer but she even appears. Another attempt, instead of using the default maxResolution bounds and used them in the openlayers geoserver, open the layer in openlayers with geoserver teclei F12 and copied the properties and bounds maxResolution to my map, it did not work. The question is: why the WMS layer does not appear?

My code:

My OpenLayers Map var map; var mercatorProjection = new OpenLayers.Projection('EPSG:900913'); var latLongProjection = new OpenLayers.Projection('EPSG:4326'); var bounds = new OpenLayers.Bounds( -51.2809219360352, -30.2445888519287, -51.0207977294922, -29.9661273956299 ); function init() { map = new OpenLayers.Map('map_element',{ maxExtent: bounds, maxResolution: 0.0010877400636672, units: 'm', //allOverlays: true, projection: mercatorProjection, displayProjection: latLongProjection }); var google_streets = new OpenLayers.Layer.Google( "Ruas", {numZoomLevels: 20} ); var wms_layer = new OpenLayers.Layer.WMS( 'WMS', 'http://localhost:8080/geoserver/Teste/wms', {layers: 'Teste:eek:nibus', transparent: true}, {isBaseLayer: false, opacity: 0.7} ); //Adiciona as camadas ao mapa map.addLayers([google_streets, wms_layer]); var point = new OpenLayers.LonLat(-51.01,-30.01); point.transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); map.setCenter(point, 10); //Camada de controle que vai mostrar as camadas no mapa map.addControl(new OpenLayers.Control.LayerSwitcher({})); //Verifica se o mapa tem um ponto central e o extende a sua extens

أكثر...
 
أعلى