Geocoding tersine;

0 Cevap php

Hi there I am able to reverse geocode to a location based on lat/long values. But my problem is i just need the country and city name, nothing else.

Bu olur google mevcut verilere göre sürekli değişiyor tarafından verilen json veri. Bazen bir yöreden dize vardır, ancak bazı lat / uzun yerle ilgili hiçbir bilgi yoktur. Tüm olası json dizelerden şehri ve ülkeyi ayıklamak bir kural ya da bazı sarıcı sınıf var mı?

örneğin, http://maps.google.com/maps/geo?q=24.487148563173424,-78.046875&output=json me verir

{
  "name": "24.487148563173424,-78.046875",
  "Status": {
    "code": 200,
    "request": "geocode"
  },
  "Placemark": [ {
    "id": "p1",
    "address": "Central Andros, The Bahamas",
    "AddressDetails": {
   "Accuracy" : 3,
   "Country" : {
      "CountryName" : "The Bahamas",
      "CountryNameCode" : "BS",
      "SubAdministrativeArea" : {
         "SubAdministrativeAreaName" : "Central Andros"
      }
   }
},
    "ExtendedData": {
      "LatLonBox": {
        "north": 24.6312368,
        "south": 24.3062499,
        "east": -77.7177462,
        "west": -78.2299838
      }
    },
    "Point": {
      "coordinates": [ -77.9738650, 24.4688482, 0 ]
    }
  } ]
}

burada http://maps.google.com/maps/geo?q=47.33882269482199,-100.634765625&output=json bana verir gibi

{
  "name": "47.33882269482199, -100.634765625",
  "Status": {
    "code": 200,
    "request": "geocode"
  },
  "Placemark": [ {
    "id": "p1",
    "address": "11445 471st Ave NE, McClusky, ND 58463, USA",
    "AddressDetails": {
   "Accuracy" : 8,
   "Country" : {
      "AdministrativeArea" : {
         "AdministrativeAreaName" : "ND",
         "SubAdministrativeArea" : {
            "Locality" : {
               "LocalityName" : "McClusky",
               "PostalCode" : {
                  "PostalCodeNumber" : "58463"
               },
               "Thoroughfare" : {
                  "ThoroughfareName" : "11445 471st Ave NE"
               }
            },
            "SubAdministrativeAreaName" : "Sheridan"
         }
      },
      "CountryName" : "USA",
      "CountryNameCode" : "US"
   }
},
    "ExtendedData": {
      "LatLonBox": {
        "north": 47.3307737,
        "south": 47.3244785,
        "east": -100.6025856,
        "west": -100.6089256
      }
    },
    "Point": {
      "coordinates": [ -100.6089257, 47.3276298, 0 ]
    }
  } ]
}

Is there some standard procedure where i can get the city and country name? Right i am traversing through the json, trying to handle the different formats that gogole is throwing at me.

Teşekkürler

0 Cevap