开发者

Read JSON data returned by google maps

In my app I use the BlackBerry API to get latitude and longitude. I would like to do reverse geocoding using Google maps by creating an http connection. How do I parse the data, and then read a specific element, such as the address?

An example URL:

http://maps.google.com/maps/geo?json&ll=9.6,73.7

Gives response:

{
  "name": "9.600000,76.760000",
  "Status": {
    "code": 200,
    "request": "geocode"
开发者_运维技巧  },
  "Placemark": [ {
    "id": "p1",
    "address": "Kanjirappalli Elikkulam Rd, Kerala, India",
    "AddressDetails": {
   "Accuracy" : 6,
   "Country" : {
      "AdministrativeArea" : {
         "AdministrativeAreaName" : "Kerala",
         "SubAdministrativeArea" : {
            "SubAdministrativeAreaName" : "Kottayam",
            "Thoroughfare" : {
               "ThoroughfareName" : "Kanjirappalli Elikkulam Rd"
            }
         }
      },
      "CountryName" : "India",
      "CountryNameCode" : "IN"
   }


Use the JSON ME library. See Using JSON in Java ME for examples of how to use it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜