2012-02-15 63 views
3

获得地址的名字我可以得到msdn如使用GeoCoordinateWatcher类的Windows Phone 7目前的GPS坐标,我只能得到纬度经度值,但我希望得到地址为。市场上有一个名为“Where I I”的免费应用程序,它也显示地址名称,所以我认为它是可能的。
我该怎么做?如何使用GPS与WP7

回答

2

您可以使用谷歌或雅虎的API

http://maps.google.com/maps/geo?q=20.0,2.0&output=json&oe=utf8&sensor=true&key=YOURKEY

http://where.yahooapis.com/geocode?q=20.0,2.0&flags=J&gflags=R&appid=YOURKEY

下面是来自谷歌

{ 
    "name": "20.00,2.00", 
    "Status": { 
     "code": 200, 
     "request": "geocode" 
    }, 
    "Placemark": [ 
     { 
      "id": "p1", 
      "address": "Adrar des Ifôghas, Mali", 
      "AddressDetails": { 
       "Accuracy": 0, 
       "AddressLine": [ 
        "Adrar des Ifôghas" 
       ] 
      }, 
      "ExtendedData": { 
       "LatLonBox": { 
        "north": 22.6604651, 
        "south": 17.2938071, 
        "east": 6.0979005, 
        "west": -2.0979005 
       } 
      }, 
      "Point": { 
       "coordinates": [ 
        2, 
        20, 
        0 
       ] 
      } 
     } 
    ] 
} 
样本JSON响应

编辑

您可以使用Web客户端来获取结果

WebClient w = new WebClient(); 
string page = w.DownloadString(url); 

下面是解析JSON结果

Google Maps v3 geocoding server-side

Looking for a REST with JSON client library

+0

我如何使用样本在c#中的apis应用? – 2012-02-15 14:04:17

+0

@mekici,我更新了答案 – 2012-02-15 14:09:34

+0

非常感谢。没有任何API的权利? – 2012-02-15 14:10:54