如何使用带有GPS WP7获得地址名称 [英] How to get Address name using GPS with wp7

查看:101
本文介绍了如何使用带有GPS WP7获得地址名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用GeoCoordinateWatcher类上的 MSDN ,我只能得到的纬度的和的经度的值,但我希望得到的地址的该位置。目前市场上的免费应用程序名为我在哪里,它显示的地址名称也一样,所以我认为它可能。
结果
我怎么做到的?

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?

推荐答案

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

You can use Google or Yahoo APIs

http://maps.google.com/maps/geo?q=20.0,2.0&output=json&oe=utf8&sensor=true&键= 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
                ]
            }
        }
    ]
}

修改

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

You can use WebClient to get the result

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

下面是解析JSON结果

Here are the samples to parse the Json result

谷歌地图V3的地理编码服务器端

寻找使用JSON客户端REST库

这篇关于如何使用带有GPS WP7获得地址名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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