<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic WebTiledLayer invisible at some zoom levels in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1557197#M5368</link>
    <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;I am running into an issue with my app where my tiled layers sometimes are not visible, depending on the zoom level.&lt;/P&gt;&lt;P&gt;Starting with the SDK example with an empty basemap, I add a layer and then set the viewpoint. Many scales work fine, but sometimes it does not. For example if I do this inside the setMapView API:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;    if (!mapView || mapView == m_mapView) {
        return;
    }
    m_mapView = mapView;
    m_mapView-&amp;gt;setMap(m_map);
   
    auto layer = new WebTiledLayer("https://{subDomain}.tile.openstreetmap.org/{level}/{col}/{row}.png", QStringList { "a", "b", "c" });
    m_map-&amp;gt;basemap()-&amp;gt;baseLayers()-&amp;gt;append(layer);

    connect(m_map, &amp;amp;Map::loadStatusChanged, this, [&amp;amp;](LoadStatus loadStatus)
    {
        if (loadStatus == LoadStatus::Loaded)
        {
            auto point = Point(-109.37801138359127, -27.102741576507512, SpatialReference::wgs84());
            auto viewpoint = Viewpoint(point, 701.4829384369524);
            m_mapView-&amp;gt;setViewpointAsync(viewpoint, 0.0);
       }
    });

    emit mapViewChanged();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some observations:&lt;BR /&gt;1. Zooming in/out brings the tiles back&lt;BR /&gt;2. Other layer types (like&amp;nbsp;&lt;SPAN&gt;ArcGISTiledLayer) work fine&lt;BR /&gt;3. If the initial map constructor is set like this "m_map(new Map(BasemapStyle::OsmStandard, this))", then that works.&lt;BR /&gt;4. I believe this happens on all platforms&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Nov 2024 05:32:16 GMT</pubDate>
    <dc:creator>JustinSteventon</dc:creator>
    <dc:date>2024-11-11T05:32:16Z</dc:date>
    <item>
      <title>WebTiledLayer invisible at some zoom levels</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1557197#M5368</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;I am running into an issue with my app where my tiled layers sometimes are not visible, depending on the zoom level.&lt;/P&gt;&lt;P&gt;Starting with the SDK example with an empty basemap, I add a layer and then set the viewpoint. Many scales work fine, but sometimes it does not. For example if I do this inside the setMapView API:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;    if (!mapView || mapView == m_mapView) {
        return;
    }
    m_mapView = mapView;
    m_mapView-&amp;gt;setMap(m_map);
   
    auto layer = new WebTiledLayer("https://{subDomain}.tile.openstreetmap.org/{level}/{col}/{row}.png", QStringList { "a", "b", "c" });
    m_map-&amp;gt;basemap()-&amp;gt;baseLayers()-&amp;gt;append(layer);

    connect(m_map, &amp;amp;Map::loadStatusChanged, this, [&amp;amp;](LoadStatus loadStatus)
    {
        if (loadStatus == LoadStatus::Loaded)
        {
            auto point = Point(-109.37801138359127, -27.102741576507512, SpatialReference::wgs84());
            auto viewpoint = Viewpoint(point, 701.4829384369524);
            m_mapView-&amp;gt;setViewpointAsync(viewpoint, 0.0);
       }
    });

    emit mapViewChanged();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some observations:&lt;BR /&gt;1. Zooming in/out brings the tiles back&lt;BR /&gt;2. Other layer types (like&amp;nbsp;&lt;SPAN&gt;ArcGISTiledLayer) work fine&lt;BR /&gt;3. If the initial map constructor is set like this "m_map(new Map(BasemapStyle::OsmStandard, this))", then that works.&lt;BR /&gt;4. I believe this happens on all platforms&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 05:32:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1557197#M5368</guid>
      <dc:creator>JustinSteventon</dc:creator>
      <dc:date>2024-11-11T05:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: WebTiledLayer invisible at some zoom levels</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1558379#M5372</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/290397"&gt;@JustinSteventon&lt;/a&gt;. Thanks for reaching out.&lt;/P&gt;
&lt;P&gt;I did some digging and I think I know what's happening here. The maximum scale level for OpenStreetMap tiles is 1128.5. Here's how I figured that out:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;    auto layer = new OpenStreetMapLayer(this);
    connect(layer, &amp;amp;Layer::doneLoading, this, [layer](const Error&amp;amp;)
    {
      qDebug() &amp;lt;&amp;lt; layer-&amp;gt;maxScale() &amp;lt;&amp;lt; layer-&amp;gt;minScale();
    });&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code you're trying to display at an initial scale of&amp;nbsp;701.4829384369524, which is outside the scale level provided by OpenStreetMap. It works after you start zooming in and out because it reaches a tile level that will work, and after we have the map tiles we start to interpolate whatever we have. Since you're using&amp;nbsp;WebTiledLayer in this case, we don't know much about the service (such as min and max scale levels), and we just request tiles.&lt;/P&gt;
&lt;P&gt;In your code if you use the max scale reported by OpenStreetMap, it should work.&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;    connect(m_map, &amp;amp;Map::loadStatusChanged, this, [&amp;amp;](LoadStatus loadStatus)
    {
        if (loadStatus == LoadStatus::Loaded)
        {
            auto point = Point(-109.37801138359127, -27.102741576507512, SpatialReference::wgs84());
            auto viewpoint = Viewpoint(point, 1128.5/*701.4829384369524*/);
            m_mapView-&amp;gt;setViewpointAsync(viewpoint, 0.0);
       }
    });&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally with some network debugging tools, I can see we are trying to fetch tiles like this one&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;A href="https://b.tile.openstreetmap.org/20/205701/606350.png" target="_blank"&gt;https://b.tile.openstreetmap.org/20/205701/606350.png&lt;/A&gt;&amp;nbsp;, when we initially load at the scale beyond the max scale and there is no such tile.&lt;/P&gt;
&lt;P&gt;Let us know if this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 22:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1558379#M5372</guid>
      <dc:creator>JamesBallard1</dc:creator>
      <dc:date>2024-11-13T22:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: WebTiledLayer invisible at some zoom levels</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1558716#M5374</link>
      <description>&lt;P&gt;This is a great explanation.&lt;/P&gt;&lt;P&gt;Saving and restoring precise viewpoints is a scenario for me, so I will need to find a workaround. I tried this:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;connect(m_map, &amp;amp;Map::loadStatusChanged, this, [&amp;amp;](LoadStatus loadStatus)
{
    if (loadStatus == LoadStatus::Loaded)
    {
        auto point = Point(-109.37801138359127, -27.102741576507512, SpatialReference::wgs84());
        auto viewpoint = Viewpoint(point, 1128.5 /*701.4829384369524*/);
        auto f = m_mapView-&amp;gt;setViewpointAsync(viewpoint, 0.0);

        QObject::connect(&amp;amp;watcher, &amp;amp;QFutureWatcher&amp;lt;void&amp;gt;::finished, [&amp;amp;]()
        {
            auto point2 = Point(-109.37801138359127, -27.102741576507512, SpatialReference::wgs84());
            auto viewpoint2 = Viewpoint(point2, 701.4829384369524);
            m_mapView-&amp;gt;setViewpointAsync(viewpoint2, 0.0);
        });

        watcher.setFuture(f);
   }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;- it 'works', but there is a delay of about 30 seconds before any tiles show up.&lt;/P&gt;&lt;P&gt;Let me know if you think of any other workarounds.&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 16:37:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1558716#M5374</guid>
      <dc:creator>JustinSteventon</dc:creator>
      <dc:date>2024-11-14T16:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: WebTiledLayer invisible at some zoom levels</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1558760#M5375</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/290397"&gt;@JustinSteventon&lt;/a&gt;&amp;nbsp;here's another idea. You can wait for the draw status to be completed the very first time, and then zoom to the viewpoint you want. There is a momentary stutter since the map appears at one scale and then immediately zooms in, but this avoids any delay. There may be other things you can do to hide the map's visibility until the zoom happens.&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;connect(m_map, &amp;amp;Map::loadStatusChanged, this, [&amp;amp;](LoadStatus loadStatus)
{
    if (loadStatus != LoadStatus::Loaded)
    {
        return;
    }

    connect(m_mapView, &amp;amp;MapQuickView::drawStatusChanged, this, [this](DrawStatus drawStatus)
    {
        // once draw status has completed the first time, set the viewpoint to the desired location
        // which is outside the supported scale location for the service
        if (drawStatus == DrawStatus::Completed)
        {
            auto point2 = Point(-109.37801138359127, -27.102741576507512, SpatialReference::wgs84());
            auto viewpoint2 = Viewpoint(point2, 701.4829384369524);
            m_mapView-&amp;gt;setViewpointAsync(viewpoint2, 0.0);
            // do this one time only
            disconnect(m_mapView, &amp;amp;MapQuickView::drawStatusChanged, this, nullptr);
        }
    });

    auto point = Point(-109.37801138359127, -27.102741576507512, SpatialReference::wgs84());
    auto viewpoint = Viewpoint(point, 1128.5);
    m_mapView-&amp;gt;setViewpointAsync(viewpoint, 0.0);
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:37:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1558760#M5375</guid>
      <dc:creator>JamesBallard1</dc:creator>
      <dc:date>2024-11-14T17:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: WebTiledLayer invisible at some zoom levels</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1561920#M5377</link>
      <description>&lt;P&gt;Thanks, this worked for me.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 23:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/webtiledlayer-invisible-at-some-zoom-levels/m-p/1561920#M5377</guid>
      <dc:creator>JustinSteventon</dc:creator>
      <dc:date>2024-11-22T23:52:00Z</dc:date>
    </item>
  </channel>
</rss>

