Custom Provider tile order

5 posts, 0 answers
  1. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 02 Aug 2011 Link to this post

    Using the latest internal build. I'm confused about the order in which the Custom provider loads the tile images. I assumed it would be the same way the map loads the map tiles, from OSM, for example. The tiles in view are loaded first. Then when you pan over to a new area, the new tiles are loaded. Instead what I'm seeing is that map control is loading all the tiles in sequential order and it doesn't show anything until all the tiles are loaded. It's even loading all the tiles when nothing is in view. So there can be a significant delay before any data shows up. Am I doing something wrong or is this an issue?
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 05 Aug 2011 Link to this post

    Hi Jason,

    The tiles are read for custom providers the same way that for OSM. The problem with delay is related to using file system for map tiles in custom provider. The tiles are downloaded using ThreadPool in separate threads, but when you use file system then the pool stops and creates each additional thread with half-second delay. You can increase the minimal number of worker thread to avoid this problem.
    The sample code is below.
    Dim workingThreads, completionPortThreads As Integer
    ThreadPool.GetMinThreads(workingThreads, completionPortThreads)
    workingThreads = 40
    ThreadPool.SetMinThreads(workingThreads, completionPortThreads)

    The alternative is to use the tiles cache subsystem. You can override the GetCachedTile method in your custom provider like to the following way:
    Protected Overrides Function GetCachedTile(ByVal tileLevel As Integer, ByVal tilePositionX As Integer, ByVal tilePositionY As Integer) As System.IO.Stream
        Dim uri As Uri = GetTile(tileLevel, tilePositionX, tilePositionY)
        If uri <> Nothing Then
            Dim path As String = uri.LocalPath
            Dim loFileStream As New IO.FileStream(path, IO.FileMode.Open, IO.FileAccess.Read)
            Return loFileStream
        End If
        Return Nothing
    End Function

    Greetings,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 05 Aug 2011 Link to this post

    Thanks for the reply. I was already using the Caching system. I tried increasing the threads, but it didn't make a difference. I'll upload an example as a ticket later. This might be more of a feature request.
  5. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 05 Aug 2011 Link to this post

    I had a random thought, and I finally figured out what the problem. It's drawing instantly now!

    The problem was related a previous question I had here:
    http://www.telerik.com/community/forums/wpf/map/multiple-mapproviders-as-layers.aspx

    When you set the GeoBounds for a provider, the map acts very different. With it set, the tiles are requested one by one. I you have 1000 tiles, nothing will show on the screen until all 1000 tiles have been loaded. Also, the tiles appear to be adjusted in size to fit the GeoBounds, as the image is slightly fuzzy.

    When you remove the GeoBounds, the tiles are requested correctly. Only the tiles in view are loaded. Add the image is razor sharp.

    I'd suggest looking into this. I don't really see a reason right off hand for the two ways to be so different. But I'm very happy now. Thank you for all your hard work.
  6. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 10 Aug 2011 Link to this post

    Hi Jason,

    When the tiled map provider uses geobounds then for high zoom levels it could have a huge image size which will require downloading a lots of tiles. So, I would recommend to restrict the zoom level for this type providers.

    Greetings,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top
UI for WPF is Visual Studio 2017 Ready