Xaml Windows Phone 8:获取当前地址-数据(从当前位置)
我试图实现一个按钮,点击后填充Xaml Windows Phone 8:获取当前地址-数据(从当前位置),xaml,map,windows-phone-8,geolocation,street-address,Xaml,Map,Windows Phone 8,Geolocation,Street Address,我试图实现一个按钮,点击后填充 纬度 经度 街头 街道号码 后酒精 城市 我的地理位置。公民地址。给我城市和邮政编码 我的地理位置。坐标。给我纬度/经度 剩下的在哪里 我使用的地图控件(不是bing地图!)来自:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps try { Geolocator geolocator = new Geolocator(); g
- 纬度
- 经度
- 街头
- 街道号码
- 后酒精
- 城市
try
{
Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracy = PositionAccuracy.Default;
IAsyncOperation<Geoposition> locationTask = null;
try
{
locationTask = geolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(15));
Geoposition myGeoposition = await locationTask;
Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
GeoCoordinate myGeoCoordinate =
CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);
试试看
{
Geolocator Geolocator=新的Geolocator();
geolocator.DesiredAccuracy=位置精度。默认值;
IAsyncOperation locationTask=null;
尝试
{
locationTask=geolocator.GetGeoPositionSync(TimeSpan.FromMinutes(1),TimeSpan.FromSeconds(15));
Geopposition MyGeopposition=等待定位任务;
Geocoordinate myGeocoordinate=我的地理位置坐标;
地理坐标myGeoCoordinate=
坐标转换器。转换地理坐标(myGeocoordinate);
您可以使用从以下位置获取信息:
MapAddress地址;
ReverseGeocodeQuery=新建ReverseGeocodeQuery();
query.geocordinate=mygeocordinate;
query.QueryCompleted+=(s,e)=>
{
如果(例如错误!=null)
返回;
address=e.Result[0]。Information.address;
};
query.QueryAsync();
您可以使用从以下位置获取信息:
MapAddress地址;
ReverseGeocodeQuery=新建ReverseGeocodeQuery();
query.geocordinate=mygeocordinate;
query.QueryCompleted+=(s,e)=>
{
如果(例如错误!=null)
返回;
address=e.Result[0]。Information.address;
};
query.QueryAsync();