On Aug 8, 2010, at 7:02 PM, ext ilias kanellos wrote:

> Hello developers, 
> 
> I am trying to do a basic setup of a map with some base layers and a few 
> navigation controls. I've started by trying out only a WMS and a Virtual 
> Earth layer. I also added a layer switcher control, and I tried setting the 
> basic map navigation keys. It all seems to work for the WMS layer, but on the 
> Virtual earth layer it seems that only zooming is possible and it won't pan. 
> What's more, it seems that the Virtual earth layer isn't "following" any 
> panning that is done when WMS is selected. Instead everytime I change to the 
> Virtual Earth layer the map centers on a fixed position with only the zoom 
> level changed. Can anyone point out where the problem might be?  

"""
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.VirtualEarth("Virtual Earth",

 
{

     
sphericalMercator: true,

     
maxExtent: new 
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)

 
});
map.addLayer(layer);
map.zoomToMaxExtent();

As you can see from the maxExtent parameter sent in the constructor of the 
layer, the coordinates stretch from -20037508.34 to 20037508.34 in each 
direction.
"""

 -- http://docs.openlayers.org/library/spherical_mercator.html

> My code looks like this:
> 
> 
>                     //Creating a new map object
>                     var newMap = new OpenLayers.Map(divId, 
>                                     {
>                                      controls: [],
>                                      projection: "EPSG:4326"
>                                     }
>                                 );
> 
>                     //Creating wms url table
>                     var urlArray = 
> ["http://t1.labs.metacarta.com/wms-c/Basic.py";,
>                                     
> "http://t2.labs.metacarta.com/wms-c/Basic.py";,
>                                     
> "http://t3.labs.metacarta.com/wms-c/Basic.py";,
>                                     
> "http://t4.labs.metacarta.com/wms-c/Basic.py";];
>                                     
>                     //Creating a WMS layer                                    
>           
>                     var wms = new OpenLayers.Layer.WMS("WMS", urlArray,
>                                     {
>                                      layers: 'basic',
>                                      displayOutsideMaxExtent: true
>                                     }
>                                 );
> 
>                       //Creating a virtual earth layer
>                       var VEhybrid = new 
> OpenLayers.Layer.VirtualEarth("Virtual Earth", 
>                                     {
>                                      type: VEMapStyle.Hybrid,
>                                      sphericalMercator: true
>                                     }
>                                 );  
> 
>                     //Setting layers and starting zoom
>                     newMap.addLayers([wms, VEhybrid]);
>                     newMap.zoomTo(1);
> 
> 
>                     //Adding map controls
>                     newMap.addControl(new OpenLayers.Control.LayerSwitcher());
>                     newMap.addControl(new 
> OpenLayers.Control.PanZoomBar({zoomWorldIcon:true}));
>                     newMap.addControl(new OpenLayers.Control.Navigation
>                                            (
>                                                 {
>                                                     zoomBoxEnabled: true,
>                                                     zoomWheelEnabled: true,
>                                                     zoomBoxKeyMask: 
> OpenLayers.Handler.MOD_SHIFT,
>                                                     autoActivate: true        
>                                             
>                                                 }
>                                            )
>                                       );
>                     newMap.addControl(new OpenLayers.Control.MousePosition());
> 
> ------------------------------------------------------------------------------------------------------------------------------------
> 
> I'm sorry if this topic is novice, but i'm a newbie to openlayers and i 
> couldn't find any answer to this.
> Also, it seemed to me that the open layers example page had a similar problem 
> when using WMS and bing maps together.
> Thank you for your help
> <ATT00001..txt>

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to