<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px">
<DIV>Thanks so much Eric. I have solved the problem by patching XYZ.js with setMap and calculateGridLayout functions from Zoomify.js</DIV>
<DIV> </DIV>
<DIV>Robert<BR><BR>>>> Eric Lemoine <eric.lemoine@camptocamp.com> 10/06/2010 7:00 p.m. >>><BR>On Tue, Jun 8, 2010 at 5:29 AM, Robert Sanson <SansonR@asurequality.com> wrote:<BR>> Hi developers<BR>><BR>> I have been struggling with trying to get tiles requested from an ArcGIS<BR>> tile cache to line up correctly with other data (requested via Layer.WMS<BR>> etc). I have tried both Layer.XYZ and Layer.ArcGISCache (from T Schaub's<BR>> sandbox).<BR>><BR>> It seems Layer.XYZ and Layer.ArcGISCache are requesting the correct tiles,<BR>> as calculated down from the specified layer tileOrigin or from the specified<BR>> map maxExtent left and top values. However, the code that calculates where<BR>> to put each tile is trying to work up from the maxExtent left and bottom<BR>> values.<BR>><BR>> The north-south displacement of the tiles changes depending on the zoom<BR>> level. I have managed to find a lower left coordinate pair that I can<BR>> specify in the map's maxExtent left and bottom that coincide exactly with<BR>> the tile corners for most of the zoom levels but not for all zoom levels.<BR>><BR>> I would like to see the positioning worked down from the layer tileOrigin,<BR>> using tileSize and resolution, rather than up from the lower left of the map<BR>> maxExtent bounds.<BR>><BR>> Is it possible to modify the OL code so that the map maxExtent and<BR>> restrictedExtent apply as map only properties, and allow one to specify the<BR>> tileOrigin for each tile cache layer plus a property that indicates whether<BR>> the tileOrigin is top left or bottom left? ArcGIS Server caches are all<BR>> worked down from the top left.<BR>><BR>> In the meantime, I have tried to add a "zoomend" event listener that traps<BR>> when the zoomend event has occurred on the map, and set a new maxExtent in<BR>> order to try and force OL to re-work out the tile placements, but to no<BR>> avail.<BR>><BR>> Here is my code:<BR>><BR>> var mapoptions = {<BR>> maxExtent: new OpenLayers.Bounds(-4020900, 4554869.11353823,<BR>> 2568710.79993, 19998100),<BR>> restrictedExtent: new<BR>> OpenLayers.Bounds(980902.6296,4672753.201,2606505.881,6298356.452),<BR>> resolutions: new Array(3175.0063500127003, //0<BR>> 793.75158750317507, //1<BR>> 264.58386250105838, //2<BR>> 198.43789687579377, //3<BR>> 132.29193125052919, //4<BR>> 66.145965625264594, //5<BR>> 26.458386250105836, //6<BR>> 19.843789687579378, //7<BR>> 13.229193125052918, //8<BR>> 9.260435187537043, //9<BR>> 6.6145965625264589, //10<BR>> 5.2916772500211673, //11<BR>> 3.9687579375158752, //12<BR>> 2.6458386250105836, //13<BR>> 1.9843789687579376, //14<BR>> 1.3229193125052918),//15<BR>> tileSize: new OpenLayers.Size(256,256),<BR>> units: 'm',<BR>> projection: new OpenLayers.Projection('EPSG:2193'),<BR>> fractionalZoom: false<BR>> };<BR>> var map = new OpenLayers.Map( 'map',mapoptions );<BR>> var topoagc = new OpenLayers.Layer.ArcGISCache({<BR>> name: "agscache",<BR>> url:<BR>> "http://ws-esrimt/MapCache/mapservice_topography_vector_prod/Layers/_alllayers/",<BR>> tileOrigin: new<BR>> OpenLayers.LonLat(-4020900,19998100)<BR>> });<BR>> map.addLayers([topoagc]);<BR>><BR>> map.events.register('zoomend', null, function() {<BR>> var zm = map.getZoom();<BR>> var curcenter = new OpenLayers.LonLat(map.getCenter());<BR>> //alert(zm);<BR>> if (zm == 9) {<BR>> alert("scale = 1:35000");<BR>> map.maxExtent.bottom = 4553175.77681822;<BR>> }<BR>> else {<BR>> map.maxExtent.bottom = 4554869.11353823;<BR>> }<BR>> map.setCenter(curcenter);<BR>> });<BR>><BR>> Any help appreciated.<BR>><BR>> Many thanks,<BR><BR><BR>Hi Robert, I don't feel very confident with tileOrigin and stuff, but<BR>I think you might be interested to look at Layer/Zoomifiy.js. Zoomify<BR>overrides calculateGridLayout to use left-top instead of left-bottom<BR>as the tile origin. It may be that Grid assumes left-bottom, whatever<BR>the value of tileOrigin in the layer. As I said, I'm not too sure<BR>about all this but take my words with caution.<BR><BR>Good luck,<BR><BR><BR><BR>-- <BR>Eric Lemoine<BR><BR>Camptocamp France SAS<BR>Savoie Technolac, BP 352<BR>73377 Le Bourget du Lac, Cedex<BR><BR>Tel : 00 33 4 79 44 44 96<BR>Mail : eric.lemoine@camptocamp.com<BR><A href="http://www.camptocamp.com">http://www.camptocamp.com</A><BR></DIV><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc. </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body></HTML>