Windows Phone 8:获取当前地址 - 数据(从当前位置) [英] Windows Phone 8: get current Address -Data (from your current location)

查看:179
本文介绍了Windows Phone 8:获取当前地址 - 数据(从当前位置)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图实现一个按钮,点击后填充


  • 纬度

  • 经度

    li>
  • 街道

  • 街道号码

  • Postalcode




myGeoposition.CivicAddress。 为我提供City和Postalcode



myGeoposition.Coordinate。 为我提供Lati / Longitude



其他?



我使用的是Map-Control(而非bing map!):Microsoft.Phone.Maps.Controls; assembly = Microsoft.Phone.Maps p>

  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 =等待locationTask;
Geocoordinate myGeocoordinate = myGeoposition.Coordinate;

GeoCoordinate myGeoCoordinate =
CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);


解决方案

您可以使用 ReverseGeocodeQuery类从一个位置获取信息:

MapAddress地址;
ReverseGeocodeQuery query = new ReverseGeocodeQuery();
query.GeoCoordinate = myGeoCoordinate;
query.QueryCompleted + =(s,e)=>
{
if(e.Error!= null)
return;

address = e.Result [0] .Information.Address;
};
query.QueryAsync();


Im trying to implement a button which fills after click

  • Latitude
  • Longitude
  • Street
  • Streetnumber
  • Postalcode
  • City

myGeoposition.CivicAddress. gives me City and Postalcode

myGeoposition.Coordinate. gives me the Lati/Longitude

where do I get the rest?

I am using a Map-Control (not bing map!) from: Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps

 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);

解决方案

You can use the ReverseGeocodeQuery class to get information from a location:

MapAddress address;
ReverseGeocodeQuery query = new ReverseGeocodeQuery();
query.GeoCoordinate = myGeoCoordinate;
query.QueryCompleted += (s, e) =>
   {
        if (e.Error != null)
            return;

        address = e.Result[0].Information.Address;
    };
query.QueryAsync();

这篇关于Windows Phone 8:获取当前地址 - 数据(从当前位置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆