I have an application showing a map of Australia. The base layer is an XYZ layer type using a third-party tile provider.<br><br>The application allows users to search for addresses. If they search for an address that is fairly close to the starting postition, e.g. in the same city, everything works as expected. However, if they search for an address in another state, the baselayer goes almost completely off the map - you can generally only see one tile in the upper LH corner.<br>
<br>This problem does not occur if they use a search mode that changes the zoom level - only if the zoom level stays the same. And so far, I have only been able to reproduce it in IE (I only have 8, but apparently the same problem occurs in 9).<br>
<br>The issue with the zoom level seems to be that the Map class moveTo method uses a different technique to reposition the map depending on whether the action changes the zoom. If it does, it resets the map parameters - specifically the layerContainerDiv.style.left and<br>
layerContainerDiv.style.top are reset to 0px. If not, the viewport container is repositioned via the centerLayerContainer method. This can alter the viewport by large amounts. <br><br>If I search for an address in an outer suburb, it will generate offsets like:<br>
<br>&lt;div id=&quot;OpenLayers.Map_26_OpenLayers_Container&quot; style=&quot;z-index: 749; position: absolute; top: -40174px; left: -57732px;&quot;&gt;<br>&lt;div class=&quot;olLayerDiv&quot; id=&quot;OpenLayers.Layer.XYZ_30&quot; style=&quot;z-index: 100; position: absolute; width: 100%; height: 100%;&quot; dir=&quot;ltr&quot; _eventCacheID=&quot;OpenLayers.Layer.XYZ_30_eventCacheID_31&quot;&gt;<br>
&lt;div style=&quot;z-index: 1; position: absolute; width: 256px; height: 256px; overflow: hidden; top: 40298px; left: 58916px;&quot;&gt;<br><br>which is OK.<br><br>However, recentering to another state produces much larger offsets:<br>
<br>&lt;div id=&quot;OpenLayers.Map_26_OpenLayers_Container&quot; style=&quot;z-index: 749; position: absolute; top: 1332917px; left: 1342177.27px;&quot;&gt;<br>&lt;div class=&quot;olLayerDiv&quot; id=&quot;OpenLayers.Layer.XYZ_30&quot; style=&quot;z-index: 100; position: absolute; width: 100%; height: 100%;&quot; dir=&quot;ltr&quot; _eventCacheID=&quot;OpenLayers.Layer.XYZ_30_eventCacheID_31&quot;&gt;<br>
&lt;div style=&quot;z-index: 1; position: absolute; width: 256px; height: 256px; overflow: hidden; top: -1332886px; left: -1340930px;&quot;&gt;<br><br>This results in a map in IE that is mostly offscreen, even though the offsets in the tile divs seem to correct the offset in the Container div.<br>
<br>All I can think is that the positioning offsets in the second case are too big in some way.<br><br>The map div is absolutely positioned, and in a jQuery tab, but no repositioning or modification to the DOM takes place after the map is loaded.<br>
<br>The layer code is pretty ordinary and the options don&#39;t seem to make any difference:<br><br>var MapOptions = {<br>                    transitionEffect: &quot;resize&quot;,<br>                    sphericalMercator: true,<br>
                    buffer: 1,<br>                    wrapDateLine: true,<br>                    isBaseLayer: true,<br>                    minZoomLevel: &lt;minZoom&gt;,<br>                    maxZoomLevel: &lt;maxZoom&gt;,<br>
                    numZoomLevels: arrResMap.length,<br>                    resolutions: arrResMap,<br>                    zoomOffset: &lt;minZoom&gt;,<br>                    units: &#39;m&#39;,<br>                    restrictedExtent: &lt;restrictedExtent&gt;,<br>
                    maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)<br>                };<br><br>(We have a local array of Spherical Mercator resolutions which is modified to set the zoom range.)<br>
<br>I originally encountered this probelm using the OSM layer type, which of course is an extension of the XYZ type.<br><br>Could anyone suggest the cause of this problem, and a solution?<br><br>Rohan Parkes<br>Melbourne<br>
Australia<br>