3

See image, particularly with the text. Why would this be happening?

enter image description here

2
  • 7
    Because it is being transformed in the map canvas to your project CRS of EPSG:3347. For visualising the xyz layer in it's native crs, set your project to EPSG:3857 and let QGIS transform your vector layer in the map canvas. Just don't rely on EPSG:3857 for any distance or area measurements.
    – Ben W
    Commented Jan 17, 2023 at 2:27
  • @BenW your comment looks like a good answer (hint hint :)
    – user2856
    Commented Jan 17, 2023 at 3:07

1 Answer 1

1

You can also achieve good image quality with your local CRS if you use a little trick with GDAL.

  1. Create a WMS description file for your TMS layer (i.e. google.xml). You can choose the max. Tilelevel here (i.e. 10):
<GDAL_WMS>
    <Service name='TMS'>
      <ServerUrl>https://maps.googleapis.com/maps/vt?pb=!1m5!1m4!1i${z}!2i${x}!3i${y}!4i256!2m3!1e0!2sm!3i664404949!3m17!2sde!3sUS!5e18!12m4!1e68!2m2!1sset!2sRoadmap!12m3!1e37!2m1!1ssmartmaps!12m4!1e26!2m2!1sstyles!2zcy50OjF8cC52Om9ufHAubDozMyxzLnQ6NXxwLmM6I2YyZTVkNCxzLnQ6NDB8cy5lOmd8cC5jOiNjNWRhYzYscy50OjQwfHMuZTpsfHAudjpvbnxwLmw6MjAscy50OjN8cC5sOjIwLHMudDo0OXxzLmU6Z3xwLmM6I2M1YzZjNixzLnQ6NTB8cy5lOmd8cC5jOiNlNGQ3YzYscy50OjUxfHMuZTpnfHAuYzojZmJmYWY3LHMudDo2fHAudjpvbnxwLmM6I2FjYmNjOQ!4e0</ServerUrl>
    </Service>
    <Transparent>FALSE</Transparent>
    <DataWindow>
      <UpperLeftX>-20037508.34</UpperLeftX>
      <UpperLeftY>20037508.34</UpperLeftY>
      <LowerRightX>20037508.34</LowerRightX>
      <LowerRightY>-20037508.34</LowerRightY>
      <TileLevel>10</TileLevel>
      <TileCountX>1</TileCountX>
      <TileCountY>1</TileCountY>
      <YOrigin>top</YOrigin>
    </DataWindow>
    <Projection>EPSG:3857</Projection>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
    <UnsafeSSL>true</UnsafeSSL>
    <MaxConnections>5</MaxConnections>
    <Cache />
</GDAL_WMS>
  1. Run gdalwarp (i.e. in OSGeo4W shell) to transform the TMS Datasource into a virtual raster (VRT) file with your project CRS (EPSG:3347). I use a bounding box to speed up processing (-te switch):
gdalwarp -r cubic -of VRT -t_srs EPSG:3347 -te 7133426 893133 7283099 983227 google.xml google3347.vrt
  1. Drag & Drop the VRT into QGIS

If you like to store the VRT datasource directly in QGIS, you need to edit the google3347.vrt file.

Exchange the following line:

<SourceDataset relativeToVRT="1">google.xml</SourceDataset>

with the content of osm.xml (replace < and > with &lt; and &gt;):

<SourceDataset relativeToVRT="0">&lt;GDAL_WMS&gt;&lt;Service name='TMS'&gt;&lt;ServerUrl&gt;https://maps.googleapis.com/maps/vt?pb=!1m5!1m4!1i${z}!2i${x}!3i${y}!4i256!2m3!1e0!2sm!3i664404949!3m17!2sde!3sUS!5e18!12m4!1e68!2m2!1sset!2sRoadmap!12m3!1e37!2m1!1ssmartmaps!12m4!1e26!2m2!1sstyles!2zcy50OjF8cC52Om9ufHAubDozMyxzLnQ6NXxwLmM6I2YyZTVkNCxzLnQ6NDB8cy5lOmd8cC5jOiNjNWRhYzYscy50OjQwfHMuZTpsfHAudjpvbnxwLmw6MjAscy50OjN8cC5sOjIwLHMudDo0OXxzLmU6Z3xwLmM6I2M1YzZjNixzLnQ6NTB8cy5lOmd8cC5jOiNlNGQ3YzYscy50OjUxfHMuZTpnfHAuYzojZmJmYWY3LHMudDo2fHAudjpvbnxwLmM6I2FjYmNjOQ!4e0&lt;/ServerUrl&gt;&lt;/Service&gt;&lt;Transparent&gt;FALSE&lt;/Transparent&gt;&lt;DataWindow&gt;&lt;UpperLeftX&gt;-20037508.34&lt;/UpperLeftX&gt;&lt;UpperLeftY&gt;20037508.34&lt;/UpperLeftY&gt;&lt;LowerRightX&gt;20037508.34&lt;/LowerRightX&gt;&lt;LowerRightY&gt;-20037508.34&lt;/LowerRightY&gt;&lt;TileLevel&gt;10&lt;/TileLevel&gt;&lt;TileCountX&gt;1&lt;/TileCountX&gt;&lt;TileCountY&gt;1&lt;/TileCountY&gt;&lt;YOrigin&gt;top&lt;/YOrigin&gt;&lt;/DataWindow&gt;&lt;Projection&gt;EPSG:3857&lt;/Projection&gt;&lt;BlockSizeX&gt;256&lt;/BlockSizeX&gt;&lt;BlockSizeY&gt;256&lt;/BlockSizeY&gt;&lt;BandsCount&gt;3&lt;/BandsCount&gt;&lt;UnsafeSSL&gt;true&lt;/UnsafeSSL&gt;&lt;MaxConnections&gt;5&lt;/MaxConnections&gt;&lt;Cache /&gt;&lt;/GDAL_WMS&gt;</SourceDataset>

and copy the content of google3347.vrt into your data source URI using the ChangeDataSourceplugin: enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.