1

I have an application which uses Qt library (version 5.8). Said application needs to draw a map, provided by a (local network) map server. The server gives only WMS maps (and is maintained by a third party, so "WMS only" clause is a given).

Qt provides a standard QML cartographic component, Map. It has several out-of-the-box plugins (which basically are responsible for actual tile requests, local tile cache maintenance and some other stuff). Surprisingly, the documentation (see paragraph "Plugin References and Parameters") doesn't tell anything about WMS support (it uses OpenStreetMap as "default" option). Even more surprisingly, information on the subject seems to be scarce. Here are the options I found:

  • There is ESRI QML class for displaying WMS layers, which requires installing the whole ArcGIS SDK, which looks heavy;
  • One can write a QML plugin of their own. But even though all I need is to change the request URLs, there seems to be no easy way to reuse existing logic of, say, OSM plugin for other plugin responsibilities (and that's a substantial amount of code);
  • A web browser component can be used in QML; it can open a local HTML page with OpenLayers or the like. That's significant overhead and in my particular case will cause problems with proxy settings (the browser component is already used in other part of the application).

My question is: are there any other known ways to use WMS server with QML components? Cartography isn't the primary focus of the application, so it doesn't require complex features like geocoding or routing.

3
  • A WMS isn't a tile service in the true sense of the word, it provides a map image for the whole extent, not a set of tiles for the whole extent of your map.
    – nmtoken
    Commented May 30, 2017 at 19:57
  • Perhaps look at QMapControl. Also I think QGIS uses Qt and QGIS supports WMS...
    – nmtoken
    Commented May 30, 2017 at 20:21
  • @nmtoken I know that. But WMS is more generic, not more specific - at least OpenLayers normally rerquest tiles from WMS source (also, price of re-rendering the whole image on every small map move is too high) (actually, OSM tile (x,y,z) triplets are easy to convert into WMS request... I guess I could add "make a proxy to change URL requests on the fly" to the list of options, but that would be even more weird solution). And yes, Quantum GIS was one of the reasons I thought the problem to be easy. Commented May 30, 2017 at 20:46

1 Answer 1

1

The QtLocation module does not include any geoservice plugin out of the box that let you specify a WMS endpoint.

In addition, it does also not include a map renderer that is able to render arbitrarily sized map crops.

This said, it would be (it is, actually) relatively straightforward to write a QtLocation geoservice plugin that performs WMS requests based on the tile x, y, and zoom level that the tiled map renderer requests.

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.