nextgis / quickmapservices_contrib

Contributed data sources for QuickMapServices
http://qms.nextgis.com
GNU General Public License v2.0
79 stars 66 forks source link

Apple satellite: Don't url-encode `accessKey` url-param #63

Closed jo-chemla closed 2 months ago

jo-chemla commented 3 months ago

In parallel to the error of validation of webp tiles preventing publishing, it seems that my apple satellite service is failing validation.

Importing the below GDAL_WMS xml does work inside qgis, but it seems that the accessKey url-param shall not be url-encoded for requests to go through - adding it as a XYZ layer source into qgis fails, but importing to qgis the below GDAL_WMS xml does work.

TMS url has the format: https://sat-cdn3.apple-mapkit.com/tile?style=7&size=1&scale=1&z={z}&x={x}&y={y}&v=9801&accessKey=1721982180_2825845599881494057_%2F_UvNg5jEboEb8eMslp86Eeymjt%2FfRcTunBvgsiAiEb6Q%3D

<GDAL_WMS>
    <Service name='TMS'>
        <ServerUrl>
            https://sat-cdn3.apple-mapkit.com/tile?style=7&amp;size=1&amp;scale=1&amp;z=${z}&amp;x=${x}&amp;y=${y}&amp;v=9801&amp;accessKey=1721982180_2825845599881494057_%2F_UvNg5jEboEb8eMslp86Eeymjt%2FfRcTunBvgsiAiEb6Q%3D
        </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:3857</Projection>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
    <Cache />
</GDAL_WMS>

Also related side-note: the Yandex satellite does not use the standard EPSG:3857 CRS but EPSG:3395 psuedo-mercator, which means there is a displacement at high zoom levels - shift increases as the zoom level increases. Supporting GDAL_WMS xmls would allow to set the correct CRS for this yandex TMS:

<GDAL_WMS><Service name="TMS"><ServerUrl>https://core-sat.maps.yandex.net/tiles?l=sat&amp;x=${x}&amp;y=${y}&amp;z=${z}&amp;scale=1&amp;lang=ru_RU</ServerUrl></Service><DataWindow><UpperLeftX>-20037508.34</UpperLeftX><UpperLeftY>20037508.34</UpperLeftY><LowerRightX>20037508.34</LowerRightX><LowerRightY>-20037508.34</LowerRightY><TileLevel>20</TileLevel><TileCountX>1</TileCountX><TileCountY>1</TileCountY><YOrigin>top</YOrigin></DataWindow><Projection>EPSG:3395</Projection><BlockSizeX>256</BlockSizeX><BlockSizeY>256</BlockSizeY><BandsCount>3</BandsCount></GDAL_WMS>

jo-chemla commented 2 months ago

Closing since apple API accessKey changes every other day. There is a workaround to get it but it cannot be embedded within the QMS frame.