[OpenLayers-Dev] Grid.js, XYZ.js, ArcGISCache.js - Inconsistent behaviour between getURL function and placement of tiles

Robert Sanson SansonR at asurequality.com
Thu Jun 10 18:25:54 EDT 2010


Thanks so much Eric. I have solved the problem by patching XYZ.js with setMap and calculateGridLayout functions from Zoomify.js
 
Robert

>>> Eric Lemoine <eric.lemoine at camptocamp.com> 10/06/2010 7:00 p.m. >>>
On Tue, Jun 8, 2010 at 5:29 AM, Robert Sanson <SansonR at asurequality.com> wrote:
> Hi developers
>
> I have been struggling with trying to get tiles requested from an ArcGIS
> tile cache to line up correctly with other data (requested via Layer.WMS
> etc). I have tried both Layer.XYZ and Layer.ArcGISCache (from T Schaub's
> sandbox).
>
> It seems Layer.XYZ and Layer.ArcGISCache are requesting the correct tiles,
> as calculated down from the specified layer tileOrigin or from the specified
> map maxExtent left and top values. However, the code that calculates where
> to put each tile is trying to work up from the maxExtent left and bottom
> values.
>
> The north-south displacement of the tiles changes depending on the zoom
> level. I have managed to find a lower left coordinate pair that I can
> specify in the map's maxExtent left and bottom that coincide exactly with
> the tile corners for most of the zoom levels but not for all zoom levels.
>
> I would like to see the positioning worked down from the layer tileOrigin,
> using tileSize and resolution, rather than up from the lower left of the map
> maxExtent bounds.
>
> Is it possible to modify the OL code so that the map maxExtent  and
> restrictedExtent apply as map only properties, and allow one to specify the
> tileOrigin for each tile cache layer plus a property that indicates whether
> the tileOrigin is top left or bottom left? ArcGIS Server caches are all
> worked down from the top left.
>
> In the meantime, I have tried to add a "zoomend" event listener that traps
> when the zoomend event has occurred on the map, and set a new maxExtent in
> order to try and force OL to re-work out the tile placements, but to no
> avail.
>
> Here is my code:
>
> var mapoptions = {
>                 maxExtent: new OpenLayers.Bounds(-4020900, 4554869.11353823,
> 2568710.79993, 19998100),
>                 restrictedExtent: new
> OpenLayers.Bounds(980902.6296,4672753.201,2606505.881,6298356.452),
>                 resolutions: new Array(3175.0063500127003, //0
>                                        793.75158750317507, //1
>                                        264.58386250105838, //2
>                                        198.43789687579377, //3
>                                        132.29193125052919, //4
>                                        66.145965625264594, //5
>                                        26.458386250105836, //6
>                                        19.843789687579378, //7
>                                        13.229193125052918, //8
>                                        9.260435187537043, //9
>                                        6.6145965625264589, //10
>                                        5.2916772500211673, //11
>                                        3.9687579375158752, //12
>                                        2.6458386250105836, //13
>                                        1.9843789687579376, //14
>                                        1.3229193125052918),//15
>                 tileSize: new OpenLayers.Size(256,256),
>                 units: 'm',
>                 projection: new OpenLayers.Projection('EPSG:2193'),
>                 fractionalZoom: false
>                 };
> var map = new OpenLayers.Map( 'map',mapoptions );
> var topoagc = new OpenLayers.Layer.ArcGISCache({
>                           name: "agscache",
>                           url:
> "http://ws-esrimt/MapCache/mapservice_topography_vector_prod/Layers/_alllayers/",
>                           tileOrigin: new
> OpenLayers.LonLat(-4020900,19998100)
>  });
> map.addLayers([topoagc]);
>
> map.events.register('zoomend', null, function() {
>                   var zm = map.getZoom();
>                   var curcenter = new OpenLayers.LonLat(map.getCenter());
>                   //alert(zm);
>                   if (zm == 9) {
>                     alert("scale = 1:35000");
>                     map.maxExtent.bottom = 4553175.77681822;
>                   }
>                   else {
>                     map.maxExtent.bottom = 4554869.11353823;
>                   }
>                   map.setCenter(curcenter);
> });
>
> Any help appreciated.
>
> Many thanks,


Hi Robert, I don't feel very confident with tileOrigin and stuff, but
I think you might be interested to look at Layer/Zoomifiy.js. Zoomify
overrides calculateGridLayout to use left-top instead of left-bottom
as the tile origin. It may be that Grid assumes left-bottom, whatever
the value of tileOrigin in the layer. As I said, I'm not too sure
about all this but take my words with caution.

Good luck,



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com 
http://www.camptocamp.com


This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100611/c81006ba/attachment.html


More information about the Dev mailing list