I can get the current GPS coordinates on Windows Phone 7 using GeoCoordinateWatcher class as shown on msdn, I can only get Latitude and Longitude values, but I want to get Address of that location. There is a free application on market named "Where Am I" it shows Address names too, so I think its possible.
How I do that?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can use Google or Yahoo APIs
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
Here is a sample json response from Google
{
"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
]
}
}
]
}
EDIT
You can use WebClient to get the result
WebClient w = new WebClient();
string page = w.DownloadString(url);
Here are the samples to parse the Json result
Google Maps v3 geocoding server-side
Looking for a REST with JSON client library