错误的坐标点 bing 地图

Wrong coordinate points bing maps

我试图将地图切割成许多矩形部分并在中心显示椭圆,如下所示:

但结果是这样的:

XAML:

<Maps:MapControl x:Name="BingMap" Loaded="BingMap_Loaded">
    <Maps:MapItemsControl x:Name="MapPins">
        <Maps:MapItemsControl.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Ellipse Fill="Red" Width="20" Height="20"></Ellipse>
                    <TextBlock Maps:MapControl.Location="{Binding Point}" Text="{Binding Count}" FontSize="20" Margin="5"/>
                </Grid>
            </DataTemplate>
        </Maps:MapItemsControl.ItemTemplate>
    </Maps:MapItemsControl>
</Maps:MapControl>

C#:

public async Task<List<Location>> ClusterCenters(double x)
{
    List<Location> locations = new List<Location>();

    for (double i = -85; i <= 85; i+=x)
    {
        for (double j = -170; j <= 170; j+=x*2)
        {
            locations.Add(new Location()
            {
                Count = 1,
                Title = String.Format("{0},{1}", i, j),
                Point = new Geopoint(new BasicGeoposition() {
                    Latitude = i,
                    Longitude = j
                })
            });
        }
    }

    return locations;
}

private async void BingMap_Loaded(object sender, RoutedEventArgs e)
{
    MapPins.ItemsSource = await ClusterCenters(10);
}

你必须记住地球不是平的:) 地图总是使用一些 projection 将地球绘制成二维地图。因此,您的点似乎不在正确的位置。

Bing 地图使用 Mercator projection. You can find more information about Bings mapping system from here。有从屏幕坐标计算经纬度的示例代码(PixelXYToLatLong 函数)。