我正在處理一個項目,在該項目中獲取設備位置並找到附近的標記。我無法在網上找到任何方式將我的位置轉換爲地理點。獲取設備位置並在地圖上設置位置
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