本文介绍了c#Windows Phone 8.1如何获取Geocoordinate对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用经度和纬度来获取Geocoordinate对象。无法通过new()获得Geocoordinates

一种方法是例如这段代码

  

您不能创建 Geocoordinate - 只有班。而是绑定到 Geopoint ,其中包含所有您需要的位置信息,而不包含 Geocoordinate 所在的位置服务行李。



public Geopoint Location {get;组; }



地图:MapControl.Location ={Binding Location}


I need to get Geocoordinate object with my Longitude and Latitude. Cannot get Geocoordinates by new() https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geocoordinate One way is for example this code

var locator = new Geolocator();
        locator.DesiredAccuracyInMeters = 50;
        var position = await locator.GetGeopositionAsync();
        Geocoordinate Coordinate = position.Coordinate;

Which gets GPS coordinate. But I need Geocoordinate with my Longitude and Latitude.

解决方案

You cannot create a Geocoordinate since it is a sealed, read-only class. Instead, bind to a Geopoint, which contains all the location info you need without the location service baggage that Geocoordinate has.

public Geopoint Location { get; set; }

Maps:MapControl.Location="{Binding Location}"

这篇关于c#Windows Phone 8.1如何获取Geocoordinate对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 11:26