2

I am loading an OSM street map into an application I am building. I load it as a raster layer via an XML document with the OSM GDAL data. My problem is that the map appears heavily mangled and pixellated, such that labels are virtually illegible:

OSM

I have noticed that setting the window size can sometimes make this issue less severe, but it's not much of a fix. Is this an issue with my XML file? The XML looks like this:

<GDAL_WMS>
  <Service name="TMS">
  <ServerUrl>http://tile.openstreetmap.org/${z}/${x}/${y}.png</ServerUrl>
  </Service>
  <DataWindow>
    <UpperLeftX>-20037508.3427892</UpperLeftX>
    <UpperLeftY>20037508.3427892</UpperLeftY>
    <LowerRightX>20037508.3427892</LowerRightX>
    <LowerRightY>-20037508.3427892</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>

As far as I know, my extents are set correctly, and reprojection doesn't seem to be relevant (I've tried it in regular Web Mercator as well as reprojecting in WGS84. It looks like this in both)

Is there something I can add to the XML document to fix this pixellation issue?

1 Answer 1

3

You have to set the scale to the fixed resolutions of the zoom levels.

The TileMapScale Plugin does that for you.

Apart from that, the QuickMapServices Plugin does a far better work than the XML.

3
  • 1
    Thanks for your reply. This seems pretty intuitive in QGIS proper, but my big issue is getting something like this for an application developed out of QGIS. My understanding is that plugins don't agree well with standalone applications. This is a tip in the right direction though.
    – Alex92
    Commented Oct 14, 2015 at 19:06
  • Since the plugins are open source, you can look up the source code and take whatever you need into your own application.
    – AndreJ
    Commented Oct 15, 2015 at 3:47
  • Unfortunately I'm pretty new to the OSM crossover to QGIS, so I'm having trouble making sense of much of this code. I've never dealt with manually altering scales, and whenever I try to import the relevant modules, I don't get an error, but also nothing changes on my canvas. I've removed every instance of "iface", but so far this is all I can really wrap my head around. Translating plugin code to standalone code has always been a headache for me.
    – Alex92
    Commented Oct 15, 2015 at 17:02

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.