[Qgis-developer] Tiled web maps in QGIS

Jochen Topf jochen at remote.org
Mon Mar 11 06:45:54 PDT 2013


Hi!

I missed support for easily using web tile servers in QGIS for a long time and
finally decided to do something about it. :-) (I am not talking about WMS-type
servers, only about those where all you have is a URL pattern such as
http://tile.openstreetmap.org/${z}/${x}/${y}.png .)

Somebody wrote down how this can be done with QGIS using GDAL:
http://www.3liz.com/blog/rldhont/index.php?post/2012/07/17/OpenStreetMap-Tiles-in-QGIS
Thats already pretty impressive, but it is harder than it should be. So I
started working on a plugin: https://github.com/joto/qgis-plugin-tiled-map .
This will give you a menu where you can easily add servers that are pre-defined
in a .yaml file. (Of course this should be configurable from QGIS at some
point.)

Now to my question: This works all very well and does mostly what I want.
But there is one issue: Of course QGIS/GDAL will resize the tiles from the
servers to fit the current screen. That's okay in many cases. But I want
to at least have the option of "snapping" to the right resolutions (will,
of course, only work in EPSG:3857).

There is already "Tile scale" panel that is used for WMS-C. Can I somehow
enable this from my plugin? I looked into the core C++ code and it looks
like it is very specifically tied to one data provider:

  if ( !rl || rl->providerType() != "wms" || !rl->dataProvider() )
    return;

Maybe this can be done in a more general way?

Is the "Tile scale" panel the right way to go? I want the user to have the
choice whether they want the snapping or not. I am not sure how the panel
is supposed to work in that case.

Jochen
-- 
Jochen Topf  jochen at remote.org  http://www.remote.org/jochen/  +49-721-388298


More information about the Qgis-developer mailing list