TileMapService Layer of EsriRuntimeQt

01-27-2016 04:14 AM
New Contributor II


Since the Qt Runtime SDK does not provide access to a simple TMS server (e.g. provided by GeoServer), I had to write one by my own. The implementation works for me with GeoServer 2.8 and a UTM 32N projection (EPSG:32632). Maybe it can help others to work around the lack of a implementation from esri...

There are some issues/workarounds:

- despite the documentation, TiledMapServiceLayer::initialize() is not called asynchronous and also can't make it's initialization asynchronous

- The TileInfo class lacks some getters/setters for the image format and spatial reference, it has to be set via json It also has no toJSon() function

- Since the y-axis in tms is mirrored (coordinate system starts bottom left, not upper left), the column needs to be adjusted. For this I have to calculate the column count for each lod. But I have to multiply my calculated column count with the magic number '4' - if someone knows why please let me know

I've attached the files - feel free to comment or make additions


Christian Ehrlicher

2 Replies
Esri Frequent Contributor

Very cool! Thanks for sharing!

A couple of things:

  • Can you try using the setDefaultSpatialReference setter on Layer baseclass? It seems to be missing from the doc, but you will see it as a protected member in the public header. Maybe that would work for setting your spatial ref.
  • For setting image format, you may not need to set this. What happens if you just don't set this?
  • Initialize should be async. Instead of overriding it, can you just call initialize once you've parsed the XML? This should be async and also execute very quickly.


New Contributor II


thx for your suggestions.

  • not setting TileInfo::format and TileInfo::spatialRefernce does work as long as Layer::setDefaultSpatialRefernce is called.It would still be nice to complete the TileInfo api
  • TiledMapServiceLayer::initialize() is called as soon as I call Map::addLayer().call stack:
    • Map::add_layer(EsriRuntimeQt::Layer*)
    • Map_impl::add_layer(EsriRuntimeQt::Layer*)
    • Map_impl::internal_add_layer_(EsriRuntimeQt::Layer*)
  • When I do not overwrite initialize() and call initialize() after the xml was parsed, I get an error (Layer already initialized) - so it looks like initialize() must be intercepted until the xml is available
  • When I overwrite initialize() to call call the base class impl it seems to work - I thought I checked this yesterday and it did not work... strange but this would be a correct async operation then
  • Why do we need TiledMapServiceLayer::setUrl() then? Calling initialize() two times does not work so I think using another url will not work either... at least it should not work as soon as the layer is initialized.

I've attached the current version, please have a look

0 Kudos