Continually requests to server

7 posts, 0 answers
  1. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 05 Jul 2013 Link to this post

    I’m using a custom Tiled Provider. It seems like while zooming, the Tile Provider continually sends requests to the server, even for the zoomlevels between the wanted zoomlevel.


    Ex: The map is at zoomlevel 13.
    I use the mousewheel to scroll down to zoomlevel 19.
    I’m not interested in zoomlevel 14-18.
    This action leads to a whole lot of requests for tiles I do not need (zoomlevel 14-18), and it slows down the solution.


    I even can get problems getting the tiles I will show on zoomlevel 19 because of all the loading.


    Is there a way to prevent this from happening?

    Could I expect the same problem when I use Bing or any other tile provider instead?

  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 08 Jul 2013 Link to this post

    Hello Rieni De Rijke,

    This way of loading tiles is the standard behavior of the RadMap. The RadMap for Silverlight shows map tiles using the standard Silverlight MultiScaleImage control. Our own implementation of the MultiScaleImage for WPF uses a similar behavior. It is standard way to show tiles using the Deep-Zoom concept.

    There is one way to show tiles for the current zoom level only. You can modify your custom provider for returning correct URIs only for current zoom level of RadMap. In other case it should return null. Also when the zoom level is changed then you should invalidate "null" tiles which were returned for this level from another levels using the MultiScaleTileSource.InvalidateTileLayer method. You can handle the RadMap.ZoomChanged event within implementation of custom TiledMapSource for this purpose.

    I have attached a sample solution which implement this functionality for OpenStreet custom provider.
    I hope it helps.

    Regards,
    Andrey Murzov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Turid Wiik
    Turid Wiik avatar
    1 posts
    Member since:
    Apr 2011

    Posted 02 Aug 2013 Link to this post

    Thank's.
    This seems to work if you zoom directly from level = "Word" to level = "Neighborhood".
    If you use the mousewheel to zoom, several more zoomlevels are requested.
    I can see that in the output window by adding System.Diagnostics.Debug.WriteLine in Your GetTile method

     

    protected override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)

    {

         int zoomLevel = this.ConvertTileToZoomLevel(tileLevel);

         System.Diagnostics.Debug.WriteLine("GetTile zoomlevel: " + zoomLevel);

         if (this.mapZoomLevel == zoomLevel)

         {

             System.Diagnostics.Debug.WriteLine("zoomlevel == mapZoomLevel");

             string url = this.tileUrlFormat;

             url = ProtocolHelper.SetScheme(url);

             url = url.Replace("{zoom}", zoomLevel.ToString(CultureInfo.InvariantCulture));

             url = url.Replace("{x}", tilePositionX.ToString(CultureInfo.InvariantCulture));

             url = url.Replace("{y}", tilePositionY.ToString(CultureInfo.InvariantCulture));

             return new Uri(url);

         }

         else

         {

             this.RegisterTile(zoomLevel, tilePositionX, tilePositionY);

         }

         return null;

    }

     

    Any suggestion on this problem will be greatly appreciated.

     

  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 05 Aug 2013 Link to this post

    Hi Turid Wiik,

    All things work as designed. When zooming using mouse wheel the zoom level is changed incrementally so tiles from these levels will be requested. You can't change anything here when zooming using mouse wheel, because there is not strong defined target zoom level.

    Regards,
    Andrey Murzov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 06 Oct 2015 Link to this post

    This has been causing me grief lately, too. Because of the amount of data we have, the data for the map is calculated for every zoom level on-demand, which can take a long time. Below is an abbreviated code example to address this. It gets the first zoom requested and the last, skipping the middle ones. If you want to ignore the first as well, maybe just stick in a timer or something in it.

    Private Property ZoomLevel as Int32
    Private Property Ready As Boolean
     
    Private Sub moMap_ZoomChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles moMap.ZoomChanged
        If Ready Then
            Ready = False
            Do
                ZoomLevel = moMap.ZoomLevel
                DrawMap()   'Time-consuming operation
            Loop While (ZoomLevel <> moMap.ZoomLevel)
            Ready = True
        End If
    End Sub

  7. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 09 Oct 2015 Link to this post

    Hi Jason,

    You can consider using the approach from the Andrey's reply. Basically, you can create a custom tile map source and return new tiles only on specific zoom levels. You can also think of an implementation that includes some kinda logic that checks if the user stopped scrolling - using a timer for example.

    Regards,
    Martin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 09 Oct 2015 Link to this post

    Hi Martin,

    That's actually what I do. I found a bug in my code that was causing my original issue. After finding it, I removed the posted code, but am using the Dispatcher now instead. It doesn't work for all cases, but since I use a custom source, it works fine:

    Windows.Application.Current.Dispatcher.Invoke(New Action(AddressOf MapDrawFinished), System.Windows.Threading.DispatcherPriority.ContextIdle)

    In MapDrawFinished I check to see if the zoom is different. Not sure if this is the ideal solution but it is working for us for now.​

Back to Top
UI for WPF is Visual Studio 2017 Ready