使用TerraService或其他方式的GPS位置和城市名称

时间:2012-02-11 10:10:23

标签: web-services windows-phone-7 gps

我有一个简单的应用程序,它通过GPS检索当前位置并显示我当前的位置。问题是我用于获取城市名称(TerraService)的Web服务不适用于非英语字符。 此外,我希望能够自定义返回数据的格式。现在它可以给我“1km SW Bart,Redmond,United States”,这并不好。 你知道如何自定义它并让它与非英文字符一起使用吗?

GeoCoordinateWatcher myGPS;
myGPS = new GeoCoordinateWatcher(); 
myGPS.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(myGPS_PositionChanged);
myGPS.Start();



void myGPS_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) 
    {

        double  myLatitude = e.Position.Location.Latitude;    //do what you want with myLatitude and myLongtitude 
        double myLongtitude = e.Position.Location.Longitude;

        GPSServiceReference.TerraServiceSoapClient client = new GPSServiceReference.TerraServiceSoapClient();

        client.ConvertLonLatPtToNearestPlaceCompleted += new EventHandler<GPSServiceReference.ConvertLonLatPtToNearestPlaceCompletedEventArgs>(client_ConvertLonLatPtToNearestPlaceCompleted);

        client.ConvertLonLatPtToNearestPlaceAsync(new GPSServiceReference.LonLatPt { Lat = myLatitude, Lon = myLongtitude });
    }

0 个答案:

没有答案