Ticket #1893 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

Setting numZoomLevels to 17 or more breaks Virtual Earth layer

Reported by: openlayers Owned by: euzuro
Priority: minor Milestone: 2.9 Release
Component: Layer.VirtualEarth Version: SVN
Keywords: Cc: trevor.timbeck@…
State: Complete

Description

If you set the numZoomLevels to 17 or higher, then when you switch away from from the VE layer and switch back, nothing is displayed.

Platform: Windows XP Browser: Firefox 3.05

Steps to reproduce: Create a map with:

map = new OpenLayers.Map( 'map', {numZoomLevels: 17});

and add a VE layer and any other layer(s). Then switch from VE to another layer, and switch back to VE. When you switch back to VE, nothing is displayed.

The reason I was trying for a zoom level higher than 17 (24 actually) is one of the layers is a TMS layer that supports a higher zoom level. The Google and Yahoo layers seem to handle this case fine. If zoomed beyond the max, they just revert to their max when you switch to that layer. But the VE layer doesn't even seem to draw properly (or at all) when you switch back to it.

Here is sample code to reproduce:

<html xmlns=" http://www.w3.org/1999/xhtml">

<head>

<style type="text/css">

#map {

width: 80%; height: 90%; border: 4px solid black;

} #banner {

width: 100%; background-color: 003366; border-top: 4px solid black; border-left: 4px solid black; border-right: 4px solid black; border-bottom: 0px solid black; padding: 0px;

}

</style>

<script src="http://openlayers.org/api/OpenLayers.js"></script> <script src=" http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1" type="text/javascript"></script> <script src=" http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>

<script type="text/javascript"> <!--

var map;

function init(){

map = new OpenLayers.Map( 'map', {numZoomLevels: 17});

var ve = new OpenLayers.Layer.VirtualEarth( "VE", {'type': VEMapStyle.Aerial}); var yahoo = new OpenLayers.Layer.Yahoo( "Yahoo"); map.addLayers([ve, yahoo]);

map.addControl(new OpenLayers.Control.LayerSwitcher());

map.zoomToMaxExtent();

} // -->

</script>

</head> <body onload="init()">

<div id="map"></div>

</body>

</html>

Attachments

1893.0.patch Download (1.3 KB) - added by fredj 3 years ago.
add two more resolutions

Change History

Changed 4 years ago by openlayers

  • type changed from feature to bug

Changed 4 years ago by openlayers

Can get it to work by specifying the max resolution in the call to create the VE layer:

var ve = new OpenLayers.Layer.VirtualEarth( "VE", {'type': VEMapStyle.Aerial, numZoomLevels: 16});

But then I realized that Virtual Earth actually has more than 16 zoom levels (19). I edited the OpenLayers.js file to include the same resolutions as Google and it works fine and you get 3 more zoom levels. Not sure if this should be opened as a separate bug.

Changed 4 years ago by crschmidt

  • milestone changed from 2.8 Release to 2.9 Release

If you're using sphericalMercator, this misbehavior doesn't appear to happen. If you can provide an example where ti does, please do; otherwise, please use sphericalMercator as a workaround.

Changed 3 years ago by fredj

see:  http://msdn.microsoft.com/en-us/library/bb412439.aspx

The zoom level can be from 1 to 19, patch to come

Changed 3 years ago by fredj

add two more resolutions

Changed 3 years ago by fredj

  • keywords VE numZoomLevels removed
  • state set to Review
  • version changed from 2.7 to SVN

tests pass, please review

Changed 3 years ago by bartvde

  • status changed from new to closed
  • state changed from Review to Complete
  • resolution set to fixed

(In [10103]) add 2 more resolutions to Bing Maps, p=fredj, r=me (closes #1893)

Note: See TracTickets for help on using tickets.