[gdal-dev] ArcGIS REST API TMS Mini-Driver with non-Web Mercator Services

Seth G sethg at geographika.co.uk
Fri Mar 8 08:44:16 PST 2024


Hi all,

I've been trying to set up the GDAL WMS driver to work with an ArcGIS tile service, as described at https://gdal.org/drivers/raster/wms.html#arcgis-rest-api
Everything works fine for Web Mercator services, but I'm not able to get this to work with a different projection.

I've used the following to create the XML service configuration file:

    gdal_translate https://utility.arcgis.com/usrsvcs/servers/6a6319c6b6bc4876b742eb907642da2e/rest/services/MapGeniePremiumITM/MapServer?f=json wms.xml -of WMS

This outputs:

    <GDAL_WMS>
      <Service name="TMS">
        <ServerUrl>https://utility.arcgis.com/usrsvcs/servers/6a6319c6b6bc4876b742eb907642da2e/rest/services/MapGeniePremiumITM/MapServer/tile/${z}/${y}/${x}</ServerUrl>
      </Service>
      <DataWindow>
        <UpperLeftX>-5022200.00000000</UpperLeftX>
        <UpperLeftY>4821100.00000000</UpperLeftY>
        <LowerRightX>-4751266.12479892</LowerRightX>
        <LowerRightY>4550166.12479892</LowerRightY>
        <TileLevel>12</TileLevel>
        <TileCountX>1</TileCountX>
        <YOrigin>top</YOrigin>
      </DataWindow>
      <Projection>EPSG:2157</Projection>
      <BlockSizeX>256</BlockSizeX>
      <BlockSizeY>256</BlockSizeY>
      <Cache/>
    </GDAL_WMS>

The following should then produce valid output (a tiny test area), and does when pointing at an XML config file for the Web Mercator services:

    SET CPL_DEBUG=ON
    gdal_translate -of PNG -outsize 512 512 -projwin 611540 640119 611640 640019 -projwin_srs "EPSG:2157" wms.xml output.png

For the above XML file the output image is empty. I've played around with all options including setting the DataWindow to the full extent referenced in the service JSON file with no luck:

    <UpperLeftX>399999.908983152</UpperLeftX>
    <LowerRightY>499999.966133265</LowerRightY>
    <LowerRightX>810000.120650242</LowerRightX>
    <UpperLeftY>999999.966133265</UpperLeftY>

Changing to the world bounds at least makes requests, but the X and Y values are way off:

    <UpperLeftX>-20037508.34</UpperLeftX>
    <UpperLeftY>20037508.34</UpperLeftY>
    <LowerRightX>20037508.34</LowerRightX>
    <LowerRightY>-20037508.34</LowerRightY>

Requesting... /tile/12/2948/2113
Actual tiles are more in the range /tile/12/61727/83181

Setting TileX and TileY can increase these values, but I'm not sure how (or if) I should be calculating them. 

Some questions:

- Are custom projections and DataWindows even supported?
- Are the values output to the XML config correct, or are they simply a template from which to start with?
- Are all the values for the XML in the service JSON file, or are there additional calculations to make?

Any advice greatly appreciated,

Seth

--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika


More information about the gdal-dev mailing list