[OpenLayers-Users] Base layers and overlays

joanne cook j.cook at oxfordarch.co.uk
Fri Nov 17 09:19:28 EST 2006


Hi List,
 
I'm very new to OpenLayers (just discovered it and think it's great). However, I have two problems that I'm a little confused about. The first is how I go about putting layers on with different projections- I would like to project something in British National Grid (EPSG:27700) over Google Maps. The second is that my British National Grid layer is wms, served from a MapGuide OpenSource server. It is always a base layer, even if I try and force it to be an overlay. I am using OpenLayers 2.2 and this is my code:
 
<script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
    
      var lon = 5;
        var lat = 40;
        var zoom = 17;
        var map, layer, options;
        function init(){
            options = {maxExtent: new OpenLayers.Bounds(0, 0, 700000, 1300000), maxResolution:'auto', units:'meters'};
      map = new OpenLayers.Map( $('map'), options , 
            { controls: [new OpenLayers.Control.MouseDefaults()] , 'numZoomLevels':20});
           var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP, 'maxZoomLevel':18} );
           map.addLayer(satellite);
            
      var oa_sites = new OpenLayers.Layer.WMS( "OA WMS", 
        "http://localhost:8008/mapguide/mapagent/mapagent.fcgi <http://localhost:8008/mapguide/mapagent/mapagent.fcgi> ?", 
        {layers: 'OASites/Layers/All_OA_Sites', format: 'png'},
        {projection:'EPSG:27700'},
        {isBaseLayer: false} );
       
      map.addLayer(oa_sites);
            
            map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5);
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
            map.addControl( new OpenLayers.Control.PanZoomBar() );
        }
        
   </script>
 
Now, this doesn't work at all for me, and I don't know if I'm trying to do something impossible by mixing the projections or if I've just mixed something up, so any help would be much appreciated!
 
Cheers
 
Jo
 
-------------------------------------------
Joanne Cook BSc MLitt AIFA MBCS
Information Systems Coordinator
Oxford Archaeology North
-------------------------------------------


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com



More information about the Users mailing list