This is a migrated thread and some comments may be shown as answers.
Set UIElement at GPS area
1 Answer 33 Views
Map
This is a migrated thread and some comments may be shown as answers.
JR
Top achievements
Rank 1
JR asked on 15 May 2010, 02:52 PM
Hi,

I would like to add a UIElement at a certain GPS area. For example add an the coat of arms image of Moscow over the city itself. Thus when i zoom in the map the image will become bigger and when i zoom out it will downsize. As far as i know it's possible to add a UIElement at a sertain aria. Here is the example code:

InformationLayer layer = new InformationLayer();
Rectangle rect = new Rectangle() { Width = 100, Height = 80, Fill = new SolidColorBrush(Colors.Black) };
layer.Items.Add(rect);
InformationLayer.SetGeographicalSize(rect, new Location(55, 37));

Thus the rectangle is positioned with it's top left corner being exactly at (55,37). When i drag the map the rectangle remains where it should be. But when i zoom in it's size doesn't grow and when i zoom out it doesn't shrink. Is there a way to set that rectangle over a whole area? For example Microsoft's MapControl  a MapLayer.SetPositionRectangle(rect, boundingRectangle);

Thanks alot.

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 19 May 2010, 03:00 PM
Hello JR,

You can add map shapes to the InformationLayer in RadMap, here is an example:

<telerik:RadMap x:Name="radMap1"  ZoomLevel="12" Center="37.684297,-122.06924">
            <telerik:InformationLayer Name="informationLayer1">
                <telerik:MapRectangle Location="37.684297,-122.06924"
                                       Width="1"
                                       Height="1"
                                       RadiusX="0.1"
                                       RadiusY="0.1"
                                       Fill="#7FFFFF00"
                                       Stroke="Red"
                                       StrokeThickness="2" />
            </telerik:InformationLayer>
        </telerik:RadMap>

and
private string VEKey = "<your_key_goes_here>";
 
        public Example()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
 
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            BingMapProvider provider = new BingMapProvider(MapMode.Aerial, true, this.VEKey);
            this.radMap1.Provider = provider;
            MapRectangle rectangle = new MapRectangle()
            {
                Location = new Location(37.684297, -122.06924),
                Width = 1,
                Height = 1,
                RadiusX = 0.1,
                RadiusY = 0.1,
                Fill = new SolidColorBrush(Color.FromArgb(127, 255, 255, 0)),
                Stroke = new SolidColorBrush(Colors.Red),
                StrokeThickness = 2
            };
            this.informationLayer1.Items.Add(rectangle);
        }

You can find more details about map shapes in this help topic.

Best regards,
Ves
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
JR
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or