Map point shape performance

4 posts, 0 answers
  1. Pedro
    Pedro avatar
    25 posts
    Member since:
    Aug 2010

    Posted 12 Oct 2010 Link to this post

    Hi,

    I need to draw a lot of points in the map, this points can be pinpoints or shape points (idealy is square points) and I would like to know what is best for performance? Use the shape or pinpoint? My initial thought was that will be the shape points. And than I have another issue I dont know how to draw square points with fixed size. I tried the rectangle shape but when I zoom in the rectangle remains with the same size.

    Regards,
    Gonçalo
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 14 Oct 2010 Link to this post

    Hi Gonçalo,

    First of all, if you need to draw a lot of points, then I would recommend using of the DynamicLayer. You can find example in our demo application:

    http://demos.telerik.com/silverlight/#Map/DynamicLayer

    If you need to show a point which DOES NOT change its size when you zoom in/out, then you can use simple Silverlight Rectangle as ItemTemplate. For example, if you need to show simple Location structures over the map, then you can do it as following:

    <UserControl x:Class="Telerik.RadMap.Silverlight.Q1.MainPage"
        xmlns:geodata="clr-namespace:GeographicalData"
        Height="600" Width="800">
        <UserControl.Resources>
            <DataTemplate x:Key="RectangleTemplate">
                <Rectangle Width="20" Height="20" Fill="Red"
                           telerik:MapLayer.Location="{Binding}" />
            </DataTemplate>
        </UserControl.Resources>
        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadMap x:Name="radMap" 
                Center="37.7847107699891, -122.421295514088"
                ZoomLevel="18">
                <telerik:RadMap.Provider>
                    <telerik:OpenStreetMapProvider />
                </telerik:RadMap.Provider>
                <telerik:InformationLayer x:Name="informationLayer" 
                    ItemTemplate="{StaticResource RectangleTemplate}" />
            </telerik:RadMap>
        </Grid>
    </UserControl>
     

    Kind regards,
    Andrey Murzov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Pedro
    Pedro avatar
    25 posts
    Member since:
    Aug 2010

    Posted 18 Oct 2010 Link to this post

    How can I draw silverlight rectangle by code?

    I'm doing something like this:

    Rectangle rect = new Rectangle;
    rect.Width = 10;
    rect.Height = 10;
     
    rect.Fill = new SolidColorBrush(Colors.Yellow);
    MapLayer.SetLocation(rect, location);
    layer.items.add(rect).

    But its not working. it crash
    when I do

    radMap.Items.Add(layer);
    layer.Visibility = System.Windows.Visibility.Visible;

    Thanks,
    Gonçalo
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 20 Oct 2010 Link to this post

    Hi Gonçalo,

    I've checked your code and it works just fine. Here it is a copy of my test code:

    private InformationLayer informationLayer;
      
    public MainPage()
    {
        InitializeComponent();
      
        this.informationLayer = new InformationLayer();
      
        Rectangle rect = new Rectangle();
        rect.Width = 10;
        rect.Height = 10;
        rect.Fill = new SolidColorBrush(Colors.Yellow);
                  
        Location location = new Location(37.7850372183918, -122.421150674801);
        MapLayer.SetLocation(rect, location);
        this.informationLayer.Items.Add(rect);
      
        this.radMap.Items.Add(this.informationLayer);
        this.informationLayer.Visibility = System.Windows.Visibility.Visible;
    }

    Note that you should not add the same information layer to the RadMap more than once. If the problem persists, please send us a small solution which we could use to reproduce it.


    Kind regards,
    Andrey Murzov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top