[OpenLayers-Users] OpenLayers.Layer.XYZ and ESRI Cache (EPSG:4326)

Andrew Hughes ahhughes at gmail.com
Fri Apr 23 02:30:22 EDT 2010


Still stuck :'(

I've added some more config to my testing map below, including an ESRI rest
overlay. This shows that the resolutions and tile bbox's appear correct, but
the translation of bbox to x/y/z is clearly busted. Any help would be good -
even if you want to tell me I'm not crazy (I'm sick to death of pink tiles).


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers Basic ESRI Map Cache Example</title>
<link rel="stylesheet" href="
http://openlayers.org/api/theme/default/style.css" type="text/css" />
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
        var map;
        function init(){
            var layerExtent = new
OpenLayers.Bounds(-83.3770978320226,42.5233499710321,-83.1508852249313,42.6258987240452);
            var resolutions = [
                               0.000297432625728785,
                               0.000152285504373138,
                               7.61427521865689E-05,
                               3.80713760932845E-05,
                               1.90333085856364E-05,
                               9.51546456231529E-06,
                               4.75892201166056E-06,
                               2.37946100583028E-06,
                               1.78459575437271E-06,
                               1.18973050291514E-06
                               ];
            var tileSize = new OpenLayers.Size(512,512);
            map = new OpenLayers.Map( 'map', {
             'restrictedExtent': layerExtent,
                'tileSize': tileSize,
                'resolutions': resolutions
                } );

            var xyz = new OpenLayers.Layer.XYZ( "ESRI","
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer/tile/${z}/${y}/${x}.jpg",{sphericalMercator:
false, 'resolutions': resolutions});
            map.addLayer(xyz);

            var arcGIS93Rest = new OpenLayers.Layer.ArcGIS93Rest( "ArcGIS
Server Layer",
                    "
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer/export
",
                    {layers: "show:0,2"},{isBaseLayer: false});
map.addLayer(arcGIS93Rest);

            var ol_wms = new OpenLayers.Layer.WMS(
                    "OpenLayers WMS",
                    "http://labs.metacarta.com/wms/vmap0",
                    {layers: 'basic'},{isBaseLayer: false, visibility:
false}
                );
map.addLayer(ol_wms);
            map.zoomToExtent(map.restrictedExtent);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.PanZoomBar());

        }
    </script>
</head>
<body onload="init()">
<div id="map" style="border: 1px solid black; width: 100%; height:
100%;"></div>
</body>
</html>



On Thu, Apr 22, 2010 at 2:14 PM, Andrew Hughes <ahhughes at gmail.com> wrote:

> Hi All,
>
> I've been unable to get a working non sphericalMercator XYZ layer working
> with an ESRI cache service. The symptom's to my problem is that the wrong
> '/${x}/${y}/${z}' tile indexes/url's are always requested. Obviousuly this
> is a result of *my* mis-configuration. I'm completely stuck on this, so
> any help would be very much appreciated.
>
> This is the public XYZ service I am trying to use:
>
> http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer
>
> JavaScript (portable):
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>OpenLayers Basic ESRI Map Cache Example</title>
> 	<link rel="stylesheet" href="http://openlayers.org/api/theme/default/style.css" type="text/css" />
> 	<script src="http://openlayers.org/api/OpenLayers.js"></script>
> 	<script type="text/javascript">
>         var map, layer;
>         function init(){
>             var layerExtent = new OpenLayers.Bounds(-83.3770978320226,42.5233499710321,-83.1508852249313,42.6258987240452);
>             var resolutions = [ 0.000297432625728785, 0.000152285504373138 ]; //just 2 for starters.
>             var tileSize = new OpenLayers.Size(512,512);
>             map = new OpenLayers.Map( 'map', {
>                 'restrictedExtent': layerExtent
>                 ,'tileSize': tileSize
>                 ,'resolutions': resolutions
>                 } );
>             layer = new OpenLayers.Layer.XYZ( "ESRI","http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer/tile/${z}/${y}/${x}.jpg <http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer/tile/$%7Bz%7D/$%7By%7D/$%7Bx%7D.jpg>",{sphericalMercator: false});
>             map.addLayer(layer);
>             map.zoomToExtent(map.restrictedExtent);
>         }
>     </script>
> </head>
> <body onload="init()">
> 	<div id="map" style="border: 1px solid black; width: 640px; height: 480px;"></div>
> </body>
>
> </html>
>
>
> Obviously there is something that is different between the above XYZ
> service and the one in the examples (
> http://openlayers.org/dev/examples/xyz-esri.html). Perhaps another example
> would be good to publish (providing I can get this working).
>
> Thanks in advance :)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100423/2478d12b/attachment.html


More information about the Users mailing list