1

I am working with a few WMS layers to try and see which one would work best with an application I'm developing out of QGIS 2.8. I need the CRS to be in EPSG 4326 but, as many of you know, most webmaps are in 3857. So far I have successfully reprojected an OpenStreetMap basemap from 3857 to 4326, but of course, it looks sort of pixelated and stretched, as the tiles are not meant for anything but 3857:

enter image description here

I have found via another post that there are a few WMS maps in native 4326. So, I tried to implement one of them by using the same method as the pixelated layer you see: I imported an XML as a raster layer. My XML looks as follows, but throws error IReadBlock failed at X offset 0, Y offset 1, as well as ERROR 1: GDALWMS: Unable to download block 0, 1:

<GDAL_WMS>
  <Service name="TMS">
  <ServerUrl>http://tilecache.osgeo.org/wms-c/tilecache.py/1.0.0/basic/5/32/23.png</ServerUrl>
  </Service>
  <DataWindow>
    <UpperLeftX>-180</UpperLeftX>
    <UpperLeftY>90</UpperLeftY>
    <LowerRightX>180</LowerRightX>
    <LowerRightY>-90</LowerRightY>
    <TileLevel>17</TileLevel>
    <TileCountX>1</TileCountX>
    <TileCountY>1</TileCountY>
    <YOrigin>top</YOrigin>
  </DataWindow>
  <Projection>EPSG:4326</Projection>
  <BlockSizeX>256</BlockSizeX>
  <BlockSizeY>256</BlockSizeY>
  <BandsCount>3</BandsCount>
  <Cache />
</GDAL_WMS>

My XML for the OpenStreetMap layer that does show is hardly different:

<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>17</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>

Should I be changing something else in my broken XML? Or is there an overall better way to do what I'm trying to accomplish? All I'd like is an EPSG 4326 open-source streetmap in proper resolution, but all my attempts at getting this are just slightly off point.

I am developing a standalone application out of QGIS 2.8, coding in Python (PyQt4) and running on Ubuntu 14.04.

  • Did you test the server URL? For me tilecache.osgeo.org/wms-c sends a 404 error "The requested URL /wms-c/ was not found on this server." I suppose you must find some other service. – user30184 Nov 5 '15 at 8:02
  • @user30184 Ahh, that could be the source of the issue then. Maybe it's just a dead link. As to another issue, I tried setting the tile count to 0 and that made the map disappear, and instead throw error QObject::connect: Cannot connect (null)::repaintRequested() to QgsMapCanvas::refresh() and error QObject::connect: Cannot connect (null)::layerCrsChanged() to QgsMapCanvas::layerCrsChange(). I've always set the tile count to 1 without questioning why, as that's how I've seen most XMLs. I'll admit that I'm not sure what it exactly changes, however. Nor am I sure why that error is throwing. – Alex92 Nov 5 '15 at 14:58
  • I tried also with tile count 0 and it gave errors, documentation in gdal.org/frmt_wms.html seems to give wrong information. – user30184 Nov 5 '15 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.