[OpenLayers-Users] Problem when switching WMS layers on and off
with Google Base Layer
Christopher Schmidt
crschmidt at metacarta.com
Thu Jan 29 16:34:25 EST 2009
On Thu, Jan 29, 2009 at 04:18:34PM -0500, Robert Hicks wrote:
> Hello all,
> I am having an issue when I have some WMS Layers over top of a Google base
> map. Basically what happens is when I toggle to layers on and off in the
> layer switcher the next time the layer appears it is shifted down relative
> to the Google map. It does not do this with the basic OpenLayers base map
> from http://labs.metacarta.com/wms/vmap0.
Use spherical mercator.
http://docs.openlayers.org/library/spherical_mercator
http://openlayers.org/dev/examples/spherical-mercator.html
-- Chris
> Here are my layer definitions:
>
> var parcels = new OpenLayers.Layer.WMS(
> "Parcels", geoserverDomain,
> {
> //width: '800',
> srs: 'EPSG:4326',
> layers: 'mylayer_parcels',
> //height: '341',
> styles: '',
> format: 'image/png',
> transparent: 'true',
> attribution: "A Service"
> }
> );
> var munic = new OpenLayers.Layer.WMS(
> "Municipality", geoserverDomain,
> {
> //width: '800',
> srs: 'EPSG:4326',
> layers: 'mylayer_munic',
> //height: '341',
> styles: '',
> format: 'image/png',
> transparent: 'true',
> attribution: "A Service"
> }
> );
> var roadcenterlines = new OpenLayers.Layer.WMS(
> "Road Center Lines", geoserverDomain,
> {
> //width: '800',
> srs: 'EPSG:4326',
> layers: 'mylayer_roadcenterlines_ft',
> //height: '341',
> styles: '',
> format: 'image/png',
> transparent: 'true',
> attribution: "A Service"
> }
> );
> var raster = new OpenLayers.Layer.WMS(
> "Defiance County Raster", geoserverDomain,
> {
> //width: '800',
> srs: 'EPSG:4326',
> layers: 'gv:county',
> //height: '341',
> styles: '',
> format: 'image/png',
> transparent: 'true',
> attribution: "A Service"
> }
> );
> var vector = new OpenLayers.Layer.Vector(
> "GlobalView",
> {
> attribution:"A Service",
> displayInLayerSwitcher: false
> }
> );
> map.addLayers([wms, raster, parcels, munic, roadcenterlines,
> vector]);
> // setup controls and initial zooms
> map.addControl(new OpenLayers.Control.PanZoomBar());
> map.addControl(new OpenLayers.Control.Navigation());
> map.addControl(new OpenLayers.Control.Scale($('scale')));
> map.addControl(new OpenLayers.Control.MousePosition({element:
> $('location')}));
> map.addControl(new OpenLayers.Control.LayerSwitcher());
> map.addControl(new OpenLayers.Control.Attribution());
> map.setCenter(new
> OpenLayers.LonLat(-84.52,41.35),11,false,false);
>
> Has anyone encountered this?
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list