This is a migrated thread and some comments may be shown as answers.

Map panning cpu usage

5 Answers 99 Views
Map
This is a migrated thread and some comments may be shown as answers.
Sayyed Hossein
Top achievements
Rank 1
Sayyed Hossein asked on 13 Aug 2016, 09:26 AM

hi dear telerik team

i have a problem that wanted to check if it was Me-Specific! you see when i pan the map around in circles the cpu usage goes up to even 99%!! i have 4 items on map in two visualization layers and my map source is a local tile source (tile files are on my own pc). AND when the control with a map in it is open i get a cpu usage waving between 1% to 30 %!

5 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 17 Aug 2016, 08:37 AM
Hello Sayyed,

We are not aware of the described issue. However, there is a memory increasing behavior that appears in some situations with the VisualizationLayer. You can see it in our feedback portal and check if the suggested workarounds will resolve your issue as well. Basically, if you are using a version of UI for WPF older than Q1 2016, you can try setting the UseBitMapCahe property of the VisualizationLayer to False.

If this doesn't help you can open a new support ticket and send a project demonstrating the issue.

Regards,
Martin
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Sayyed Hossein
Top achievements
Rank 1
answered on 07 Nov 2016, 04:55 AM

the version of dlls i am using is 2016.3.914.40

and i have offline maptiles on my PC and use a custom source these are the codes for a very simpler situation(no visualizationlayer) that also has CPU usage of up to 70-80 percent while panning

1- LocalhostProvider.Cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.Windows.Controls.Map;
 
namespace Tetra.DispatchingSystem.UI.ViewModels.AVL
{
    public class LocalhostProvider : TiledProvider
    {
        public LocalhostProvider(string tileUriFormat)
            : base()
        {
            LocalhostTileSource source = new LocalhostTileSource(tileUriFormat);
            this.MapSources.Add(source.UniqueId, source);
        }
 
        public override ISpatialReference SpatialReference
        {
            get
            {
                return new MercatorProjection();
            }
        }
    }
 
}

 

2-LocalhostTileSource.Cs :

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Telerik.Windows.Controls.Map;
 
namespace Tetra.DispatchingSystem.UI.ViewModels.AVL
{
    public class LocalhostTileSource : TiledMapSource
    {
        private string tileUriFormat;
 
        public LocalhostTileSource(string tileUriFormat)
            : base(1, 20, 256, 256)
        {
            this.tileUriFormat = tileUriFormat;
        }
 
        public override void Initialize()
        {
            try
            {
                this.RaiseInitializeCompleted();
 
            }
            catch (Exception ex)
            {
            }
        }
 
        protected override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)
        {
 
            //int zoomLevel = tileLevel;
 
            int zoomLevel = ConvertTileToZoomLevel(tileLevel);
            string url = this.tileUriFormat.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);
        }
    }
 
}

 

3-  MainWindow.xaml :

<Window x:Class="StandAloneMapTest.MainWindow"
        x:Name="_this"
        Title="window" Height="700" Width="700">
    <Grid>
 
            <telerik:RadMap FlowDirection="LeftToRight" Margin="5" x:Name="radMap" Provider="{Binding ElementName=_this,Path=Provider}"
                        Center="33.8469016440728,52.9080691223145"
                        MiniMapExpanderVisibility="Collapsed" MinZoomLevel="13" MaxZoomLevel="19"
                        CommandBarVisibility="Collapsed" NavigationVisibility="Collapsed" ZoomBarPresetsVisibility="Collapsed" >
 
            </telerik:RadMap>
 
 
    </Grid>
</Window>

 

4-MainWindow.xaml.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls.Map;
using Tetra.DispatchingSystem.UI.ViewModels.AVL;
 
namespace StandAloneMapTest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            DataContext = this;
            InitializeComponent();
        }
 
        private TiledProvider _provider;
        public TiledProvider Provider
        {
            get
            {
                if (this._provider==null)
                {
                    string mapPath = "c:/OfflineMap";
                    this._provider = new LocalhostProvider(@"" + mapPath + "/gm_{x}_{y}_{zoom}.png"); ;
                }
                return this._provider;
            }
            set
            {
                if (this._provider != value)
                {
                    this._provider = value;
                     
                }
            }
        }
     }
}

 

my tiles are store in c:\offlinemap and are read from there

thank you in advance for your help

:

0
Martin Ivanov
Telerik team
answered on 08 Nov 2016, 11:58 AM
Hi Sayyed,

I tested your code with OS map tiles images and the panning and zooming process takes up to 40% of the CPU, which depends on the pictures size. Note that bigger pictures might take more processing time. However, this is a bit far from the 70-100% percent that you mentioned. If you share the image files I can take a peek and see if I can give you more information on this.

Regards,
Martin
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Sayyed Hossein
Top achievements
Rank 1
answered on 13 Nov 2016, 05:49 AM

my pictures are png tiles from google earth. the size of them varies between 1KB to 50KB depending on zoom.

and my cpu is a G2030 @ 3.00 GHz 3.00 GHz

 

0
Martin Ivanov
Telerik team
answered on 16 Nov 2016, 02:43 PM
Hi Sayyed,

I can't reproduce the issue with the provided information. The pictures I used for testing are more or less the same size (1-50KB).

Regards,
Martin
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Tags
Map
Asked by
Sayyed Hossein
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Sayyed Hossein
Top achievements
Rank 1
Share this question
or