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

Show Coordinates in Map Legend converted to other projection system

2 Answers 186 Views
Map
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Manfred
Top achievements
Rank 2
Manfred asked on 24 Nov 2011, 10:39 AM
Hi there,

can anyone give me a short descritpion, how to change the map legend where the current coordinates are displayed to an other projection system?

We do this:
our collegues send some coordinates, we transform them to show the point in our map.
But we want the to show the coordinates he send in the legend.
A short example how to do that would be fine.

Best Regards
Manfred

2 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 28 Nov 2011, 03:21 PM
Hello Manfred,

The MapLegend is a specific control which is designed for using with colorizer only. So, you can't use it to display coordinates.

It seems you mean the MapMouseLocationIndicator (Mouse Position Coordinates or Mouse Location control) which is described in documentation at the following links:
http://www.telerik.com/help/silverlight/radmap-visual-structure.html
http://www.telerik.com/help/silverlight/radmap-features-mouse-location.html

Unfortunately this control supports displaying location using the Number format or using the Geographical format only. It does not support displaying location in different projection systems. So, you should disable it in RadMap with setting the MouseLocationIndicatorVisibility to "Collapsed" and you should create you own implementation of control like the MapMouseLocationIndicator. You can use the RadMap.MouseMove event to get the current mouse location.
The sample code is below.

<UserControl x:Class="CustomMouseLocator.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="700">
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadMap x:Name="radMap"
                        MouseLocationIndicatorVisibility="Collapsed"
                        MouseMove="radMap_MouseMove"
                        Center="40,-100"
                        ZoomLevel="5">
            <telerik:RadMap.Provider>
                <telerik:OpenStreetMapProvider />
            </telerik:RadMap.Provider>
        </telerik:RadMap>
        <Border HorizontalAlignment="Left" VerticalAlignment="Bottom"
                Width="220" Height="22"
                Margin="20,0,0,20"
                Background="#ffafafaf"
                BorderBrush="Black"
                BorderThickness="1"
                CornerRadius="5">
            <TextBlock x:Name="mouseLocator"
                       TextAlignment="Center"
                       Padding="0,3,0,0"/>
        </Border>
    </Grid>
</UserControl>

 

using System.Windows.Controls;
using System.Windows.Input;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Map;
 
namespace CustomMouseLocator
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
 
        private void radMap_MouseMove(object sender, MouseEventArgs e)
        {
            RadMap map = sender as RadMap;
            if (map != null)
            {
                Location mouse = Location.GetCoordinates(map, e.GetPosition(map));
                this.mouseLocator.Text = this.LocationToString(mouse);
            }
        }
 
        private string LocationToString(Location mouse)
        {
            // TODO: should implement convertion to string format of required coordinate system
            return mouse.ToString();
        }
    }
}

Kind regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Manfred
Top achievements
Rank 2
answered on 19 Mar 2012, 08:26 AM
Hi Andrey,

sorry for replying so late ;-)

It worked fine for me, thanks a lot for your help.

Best Regards
Manfred
Tags
Map
Asked by
Manfred
Top achievements
Rank 2
Answers by
Andrey
Telerik team
Manfred
Top achievements
Rank 2
Share this question
or