[OpenLayers-Dev] 256x256

Robert Sanson SansonR at asurequality.com
Tue May 18 19:00:02 EDT 2010

Thanks Chris. So instead of making use of tileOrigin, we make sure the Origin as reported by ArcGIS is contained within the maxExtent, and then use restrictedExtent to constrain the map area to the are we want OL to work within:
var mapoptions = {
  //tileOrigin: new OpenLayers.LonLat(-4020900,19998100), //Origin as reported by ArcGIS
    maxExtent: new OpenLayers.Bounds(-4020900, 4674128.11975, 2568710.79993, 19998100),
    restrictedExtent: new OpenLayers.Bounds(1018697.71047, 4674128.11975, 2568710.79993, 6296981.53325),
    resolutions: new Array(3175.0063500127, 793.751587503175, 264.583862501058, 198.437896875794, 132.291931250529, 66.1459656252646, 26.4583862501058, 19.8437896875794, 13.2291931250529, 9.26043518753704, 6.61459656252646, 5.29167725002117, 3.96875793751588, 2.64583862501058, 1.98437896875794, 1.32291931250529),
    tileSize: new OpenLayers.Size(256,256),
    units: 'm',
    projection: new OpenLayers.Projection('EPSG:2193'),
    fractionalZoom: false
var map = new OpenLayers.Map( 'map',mapoptions );
var topoxyz = new OpenLayers.Layer.XYZ( "Topo",
                   {isBaseLayer: false, sphericalMercator: false//, tileOrigin: new OpenLayers.LonLat(-4020900,19998100)

Doing this above, requests the correct tiles, but it seems the requested tiles are displaced in a north-south direction. I have created a test web site that has two "identical" layers from the same ArcGIS Server - one is called using Layer.WMS, the other Layer.XYZ. The latter is sometimes displaced to the north, and sometimes to the south, depending on Zoom level. I have previously verified the WMS layer is in the correct location. 
Many thanks,
Robert Sanson

>>> <christopher.schmidt at nokia.com> 18/05/2010 1:26 a.m. >>>

On May 16, 2010, at 5:01 PM, ext Robert Sanson wrote:

> On a related matter, I have discovered that ArcGIS Server default tile cache origin is top left, not bottom left as it is for other cache schemas. Is there any way to tell OpenLayers.Layer.XYZ to work out tiles to request when tile origin is top left? Setting tileOrigin on the map object and the layer property seems to make no difference.

This should already be the case?

        var y = Math.round((this.maxExtent.top - bounds.top)
            / (res * this.tileSize.h));

-- Chris

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/20100519/b87a6a6e/attachment.html

More information about the Dev mailing list