3

I'm using Google Maps v3 as a base layer and on top of that I create an overlay pointing to my WMS (streets and avenues).

A few months ago all works fine, my WMS layer was not overlapping the Google Maps footer (Google logo and copyright), but today it is.

Here is how it looks:

Image Issued

Here is the code:

var
  map,
  stylez = [
    {
      featureType: "administrative",
      elementType: "geometry",
      stylers: [
        { visibility: "off" }
      ]
    },{
      featureType: "landscape",
      elementType: "geometry",
      stylers: [
        { visibility: "off" }
      ]
    },{
      featureType: "road",
      elementType: "geometry",
      stylers: [
        { visibility: "off" }
      ]
    },{
      featureType: "transit",
      elementType: "geometry",
      stylers: [
        { visibility: "off" }
      ]
    },{
      elementType: "labels",
      stylers: [
        { visibility: "off" }
      ]
    }
  ],
  gmap = new OpenLayers.Layer.Google("Google Styled", {
    type: 'styled'
  }),
  styledMapOptions = {
    name: "Styled Map"
  },
  styledMapType = new google.maps.StyledMapType(stylez, styledMapOptions),
  projection = new OpenLayers.Projection("EPSG:900913"),
  displayProjection = new OpenLayers.Projection("EPSG:4326"),
  bounds = new OpenLayers.Bounds(-57.81887, -25.53276, -57.24308, -25.17649).transform(
    displayProjection,
    projection
  );

// avoid pink error tiles
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.Util.onImageLoadErrorColor = "transparent";
OpenLayers.ImgPath = "http://js.mapbox.com/theme/dark/";

function init() {

  var
    options = {
      controls: [
        new OpenLayers.Control.Navigation(),
        new OpenLayers.Control.PanZoomBar(),
        new OpenLayers.Control.LayerSwitcher(),
        new OpenLayers.Control.MouseDefaults(),
        new OpenLayers.Control.KeyboardDefaults()
      ],
      projection: projection,
      displayProjection: displayProjection,
      units: "meters",
      numZoomLevels: 12 /* 18 */,
      minZoomLevel: 6,
      maxResolution: 156543.033928041,
      maxExtent: new OpenLayers.Bounds(-2.003750834E7,-2.003750834E7,2.0037508345578495E7,2.0037508345578495E7)
    };

  map = new OpenLayers.Map('map', options);

  // base layer
  var tiled = new OpenLayers.Layer.WMS(
    "Roadmap",
    "http://foo.com:80/geoserver/gwc/service/wms",
    {
      LAYERS: 'Foo',
      STYLES: '',
      format: 'image/png',
      tiled: true,
      transparent: "true",
      tilesOrigin: map.maxExtent.left + ',' + map.maxExtent.bottom
    },
    {
      isBaseLayer: false,
      opacity: 1.0,
      visibility: true
    }
  );

  tiled.events.register("loadstart", tiled, function() {
      console.debug("Foo, Load Start");
  });

  tiled.events.register("loadend", tiled, function() {
      console.debug("Foo, Load End");
  });

  map.addLayers([gmap, tiled]);

  map.zoomToExtent(bounds);

  gmap.mapObject.mapTypes.set('styled', styledMapType);
  gmap.mapObject.setMapTypeId('styled');

}
  • can you try with removing stylez of google map? or try to raiseLayer which name is tiled... – Aragon Jun 5 '12 at 6:47
  • i will try to remove styles from google ... quez: how riseLayers (order in array of addLayers method??) – outaTiME Jun 5 '12 at 18:44
  • no way ... removing styles does nothing ! same effect ... ;( – outaTiME Jun 5 '12 at 19:20
  • nobody knows ?!? – outaTiME Jun 18 '12 at 13:53
2

Solved using openlayers from github trunk, no more "google" footer.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.