[OpenLayers-Users] Layer.XYZ tiles from ArcGIS Server not lining up with other layers

Robert Sanson SansonR at asurequality.com
Sun May 30 19:34:29 EDT 2010


This is a resend, as I have not had any responses. Tiles I request from an ArcGIS Server cache using Layer.XYZ are not lining up with other layers requested from the same server via Layer.WMS or Layer.ArcGIS93Rest. 
 
Instead of making use of tileOrigin (which doesn't seem to get used), 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), //contains the AGS origin
    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 nzcoastwms = new OpenLayers.Layer.WMS( "Coastline",
                          "http://ws-esrimt/arcgis/services/mapservice_asurequality_prod/MapServer/WMSServer",
                          {layers: ['0'], format: "image/png"},
                          {isBaseLayer: true, singleTile:true, visibility: true,
                           attribution:"LINZ data Crown copyright reserved"} );
var topoxyz = new OpenLayers.Layer.XYZ( "Topo",
                    "http://ws-esrimt/ArcGIS/rest/services/mapservice_topography_vector_prod/MapServer/tile/${z}/${y}/${x}",
                   {isBaseLayer: false, sphericalMercator: false//, tileOrigin: new OpenLayers.LonLat(-4020900,19998100)
});
map.addLayers([nzcoastwms,topoxyz]);

Doing this above, requests the correct tiles, but it seems the requested tiles are displaced in a north-south direction. The displacement seems different depending on zoom level. 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


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-users/attachments/20100531/db73079f/attachment.html


More information about the Users mailing list