[OpenLayers-Users] Virtual Earth map troubles in IE7

Christopher Schmidt crschmidt at metacarta.com
Tue Jul 29 20:59:02 EDT 2008


On Tue, Jul 29, 2008 at 06:41:53PM -0600, David Wright wrote:
> Greetings,  
> 
>  
> 
> I'm trying to use MetaCarta GTS collections on Virtual Earth maps.  With
> the hosted OpenLayers.js, I get a script error in IE7 when panning after
> I zoom all the way out.  I also get the error when initializing the map
> to global scale using a "1" like this: mccontrol.map.setCenter(new
> OpenLayers.LonLat(-95,38), 1);

David,

I can't trivially replicate this error using Firefox (the platform that
I have handy). However, I do notice some things that aren't working as
you expect them. Specifically: 
 
  * minZoomLevel and maxZoomLevel need to be MIN_ZOOM_LEVEL and
    MAX_ZOOM_LEVEL. When I do this, I get the more-expected behavior
    from this map.

  * VE allows panning outside their 'world' within OpenLayers: you can
    prevent this by setting:
      mccontrol.map.restrictedExtent = new
        OpenLayers.Bounds(-180,-85,180,85)

With these two in place, I Get much better behavior with your map. This
might help fix your IE issue as well.

-- Chris

>  
> 
> Here's the error:
> 
>  
> 
> Line 51; Char 37; Invalid Argument; Code 0
> 
> Heres the URL: http://www.metalens.org/mcve/
> 
> Thanks for any insight you can share.
> 
>  
> 
> Here's the page code:
> 
>  
> 
> <html>
> 
> <head>
> 
> <meta http-equiv="Content-Type" content="text/html;
> charset=windows-1252"/>
> 
> <script type="text/javascript"
> src='http://216.17.239.67/developers/tools?version=1.0.0&file=GeoSearch.
> js'></script>
> 
> <script type="text/javascript"
> src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>
> 
> <!--<script type="text/javascript"
> src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1"></scr
> ipt>-->
> 
> <!--<script type="text/javascript"
> src="http://www.openlayers.org/api/OpenLayers.js"></script>-->
> 
> <script defer="defer" type="text/javascript">
> 
> <!--
> 
> function metacarta_init(){
> 
>     mccontrol = MetaCarta.GeoSearch.Init({'applianceHost':
> 'gts.metalens.org', 'textDivId': 'list', 'mapDivId': 'map',
> 
>                                           'searchParams': [''] });
> 
>     // add new layers
> 
>     var ve = new OpenLayers.Layer.VirtualEarth("ve", {'minZoomLevel': 2,
> 'maxZoomLevel': 10, 'wrapDateLine': true, 'displayOutsideMaxExtent':
> true});
> 
>  
> 
>     // add a LayerSwitcher
> 
>     //mccontrol.map.addControl(new OpenLayers.Control.LayerSwitcher());
> 
>     //mccontrol.map.removeControl(LayerSwitcher)
> 
>     //add layers
> 
>     mccontrol.map.addLayers([ve]);
> 
>     mccontrol.map.setBaseLayer(ve);
> 
>     mccontrol.map.setCenter(new OpenLayers.LonLat(-95,38), 2);
> 
>     //mccontrol.map.zoomToMaxZoomLevel(5);
> 
>  }
> 
> -->
> 
> </script>
> 
> <title>NGS Collections</title>
> 
> </head>
> 
> <body onload="metacarta_init()";>
> 
> <div id='map'  style='width:75%; height:100%; float:right;'></div>
> 
> <div id='list' style='width:25%; height:100%;'></div>
> 
> </body>
> 
> </html>
> 
> David Wright | National Geographic Maps
> 210 Beaver Brook Canyon Road | Evergreen, CO 80439
> 303.327.3108 off | 720.210.7045 mob | 303.670.2647 fax 
> dwright at ngs.org
> 
>  
> 
>  
> 

> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list