Skip to content

More Basemaps in QGIS

February 2, 2012

One of the more popular posts on this blog has been my piece on adding basemaps to QGIS. While the OpenLayer plugin is great, one of the things that I find dissatisfying is that it requires reprojecting your data to match the EPSG:3857 basemap. I often work in State Plane, and I’d just as soon have my data stay in that projection, which will also minimize local distortion. Well, as it turns out, one can add tiled map services as GDAL raster layers, with all the benefits that entails (e.g. reprojection). What you need to do is create an XML file like the following (which is lifted almost verbatim from the GDAL website, specifically this file):

  <Service name="TMS">
    <!-- note: if you use this file verbatim, you *must* credit MapQuest and OpenStreetMap! -->

Change the ServerUrl to your Tiled Map Service server (this one is for MapQuest Open Tiles), then go into QGIS, Layer->Add Raster Layer and select the XML file.

A few caveats:

  • The OpenLayers plugin automatically adds the required attributions, at least for OSM. This can be nice or not—nice in that you don’t have to remember to add the attribution, not so nice in that you can’t choose where to place the attribution; it’s always in the lower-right.
  • Reprojecting layers with text may yield strange skewing and distortion.
  • You need to be sure that you use these services legally (as you did with OpenLayers plugin).

Have fun!

You can also convert tiles to GeoTIFF using gdal_translate, but I suspect most TMS providers would prefer you didn’t.

  1. February 27, 2012 2:04 pm

    This does not work all at. I always get Error 4: .xml not recognized as a supported file format.

    • mattwigway permalink*
      February 27, 2012 9:14 pm

      Hmm… are you adding it via the ‘add raster layer’ menu? What version of QGIS are you using?

Comments are closed.

%d bloggers like this: