【问题标题】:How to get Address name using GPS with wp7如何使用 GPS 和 wp7 获取地址名称
【发布时间】:2012-03-06 20:37:05
【问题描述】:

我可以使用 GeoCoordinateWatcher 类在 Windows Phone 7 上获取当前 GPS 坐标,如 msdn 所示,我只能获取 LatitudeLongitude 值,但我想要获取该位置的地址。市场上有一个名为“我在哪里”的免费应用程序,它也显示地址名称,所以我认为它是可能的。
我该怎么做?

【问题讨论】:

    标签: c# windows-phone-7


    【解决方案1】:

    您可以使用 Google 或 Yahoo API

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

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

    这是来自 Google 的示例 json 响应

    {
        "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
                    ]
                }
            }
        ]
    }
    

    编辑

    您可以使用WebClient获取结果

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

    这里是解析 Json 结果的示例

    Google Maps v3 geocoding server-side

    Looking for a REST with JSON client library

    【讨论】:

    • 我如何在 c# 应用程序中使用该 API?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-01
    • 2011-10-11
    • 1970-01-01
    • 2021-12-05
    • 1970-01-01
    • 2014-08-08
    • 1970-01-01
    相关资源
    最近更新 更多