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

Map point shape performance

3 Answers 112 Views
Map
This is a migrated thread and some comments may be shown as answers.
Pedro
Top achievements
Rank 1
Pedro asked on 12 Oct 2010, 02:45 PM
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

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 14 Oct 2010, 09:40 AM
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
0
Pedro
Top achievements
Rank 1
answered on 18 Oct 2010, 12:00 PM
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
0
Andrey
Telerik team
answered on 20 Oct 2010, 03:54 PM
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
Tags
Map
Asked by
Pedro
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Pedro
Top achievements
Rank 1
Share this question
or