如何在地图上获得地标的geoCoordinates?

时间:2014-05-09 09:26:50

标签: xaml windows-phone-8 map windows-phone here-api

在Windows Phone 8上,我有一个包含地图的页面,双击缩放级别增加。我需要点击放置一个地标,并获得该地标的坐标。

<Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <StackPanel Name="mapContainer" Grid.Row="0" >
                <maps:Map Name="Mymap" VerticalAlignment="Top" Height="{Binding ElementName=mapContainer, Path=ActualHeight}" Width="{Binding ElementName=ContentPanel,Path=ActualWidth}" LandmarksEnabled="True" MouseLeftButtonDown="Mymap_MouseLeftButtonDown"/>
            </StackPanel>

2 个答案:

答案 0 :(得分:1)

在地图中添加点击处理程序。

让处理程序如下::

    private void MapControl_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {
        GeoCoordinate geocoordinate = this.MapControl.ConvertViewportPointToGeoCoordinate(e.GetPosition(this.MapControl));
    }

您将在地理坐标对象中拥有地图坐标。 希望我的问题正确,解决方案有所帮助。

答案 1 :(得分:0)

您可以将点击的像素位置转换为Map.ConvertViewportPointToGeoCoordinate Method

的坐标