我正在处理一个项目,在该项目中获取设备位置并找到附近的标记。我无法在网上找到任何方式将我的位置转换为地理点。获取设备位置并在地图上设置位置
public async void GetPosition() {
Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 0 };
Geoposition geoposition = await geolocator.GetGeopositionAsync();
// Needs to be converted to Geopoint
// Call UpdateLocationData
}
public async void UpdateLocationData(Geopoint geopoint) {
await MapControl1.TrySetViewAsync(geopoint);
}
我想这个代码,我发现:
// Reverse Geocoding
BasicGeoposition myLocation = new BasicGeoposition {
Longitude = position.Coordinate.Longitude,
Latitude = position.Coordinate.Latitude
};
Geopoint pointToReverseGeocode = new Geopoint(myLocation);
但它说,Coordinate.Longitude.get上的Visual Studio 2015年RC过时。
上'坐标的['Point'](https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geocoordinate.point.ASPx)属性'返回一个'Geopoint'。 – Johnbot
@Johnbot geoposition.Coordinate.Point?该死的,我会尽快查看是否正确。 – Kenny