[gdal-dev] Not able to use gdal_translate and a TMS source

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Tue Oct 5 06:57:18 PDT 2021


Hi,

There is not so much wrong, you should just read https://gdal.org/drivers/raster/wms.html more carefully and write server URL this way:

  <ServerUrl>https://tiles.wmflabs.org/osm-no-labels/${z}/${x}/${y}.png</ServerUrl>

-Jukka Rahkonen-




Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta andy
Lähetetty: tiistai 5. lokakuuta 2021 16.42
Vastaanottaja: gdal-dev at lists.osgeo.org
Aihe: [gdal-dev] Not able to use gdal_translate and a TMS source

Hi,
in QGIS I have set this XYZ source: https://tiles.wmflabs.org/osm-no-labels/{z}/{x}/{y}.png<https://tiles.wmflabs.org/osm-no-labels/%7bz%7d/%7bx%7d/%7by%7d.png>
QGIS renders it properly.

I have created this GDAL source

<GDAL_WMS>
    <Service name="TMS">
        <ServerUrl>https://tiles.wmflabs.org/osm-no-labels/{z}/{x}/{y}.png<https://tiles.wmflabs.org/osm-no-labels/%7bz%7d/%7bx%7d/%7by%7d.png></ServerUrl>
    </Service>
    <DataWindow>
        <UpperLeftX>-20037508.34</UpperLeftX>
        <UpperLeftY>20037508.34</UpperLeftY>
        <LowerRightX>20037508.34</LowerRightX>
        <LowerRightY>-20037508.34</LowerRightY>
        <TileLevel>18</TileLevel>
        <TileCountX>1</TileCountX>
        <TileCountY>1</TileCountY>
        <YOrigin>top</YOrigin>
    </DataWindow>
    <Projection>EPSG:900913</Projection>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
    <Cache />
<ZeroBlockHttpCodes>204,404</ZeroBlockHttpCodes>
</GDAL_WMS>

But if run

gdal_translate --debug ON -of PNG -projwin 5203413 2847209 5221042 2829459 -outsize 512 512 osm-no-labels.xml openstreetmap.png

I have a black PNG.

The debug shows me a wrong HTTP call (the below one), but I do not know how to modify my xml source to be able to run right requests.

HTTP: Request [1] https://tiles.wmflabs.org/osm-no-labels/{z}/{x}/{y}.png/1.0.0//12/2580/1758.jpg<https://tiles.wmflabs.org/osm-no-labels/%7bz%7d/%7bx%7d/%7by%7d.png/1.0.0/12/2580/1758.jpg>

What's wrong in my settings?

Thank you

--
___________________

Andrea Borruso
website: https://medium.com/tantotanto
38° 7' 48" N, 13° 21' 9" E, EPSG:4326
___________________

"cercare e saper riconoscere chi e cosa,
 in mezzo all’inferno, non è inferno,
e farlo durare, e dargli spazio"

Italo Calvino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211005/4bf82aad/attachment-0001.html>


More information about the gdal-dev mailing list