How to get Address name using GPS with wp7

后端 未结 1 1008
终归单人心
终归单人心 2021-01-06 12:21

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, b

相关标签:
1条回答
  • 2021-01-06 13:24

    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

    0 讨论(0)
提交回复
热议问题