0
我的代碼是如何從PHP中使用file_get_contents()函數獲取的內容檢索特定數據?
$result = file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address=".$stateName.",".$districtName.",".$cityName."&sensor=true");
其中$stateName
,$districtName
,$cityName
是由用戶給出的值
進入喀拉拉邦,艾娜庫蘭,安加馬爾伊作爲Statename的,districtName後和cityName我得到了這樣的結果:
{
"results": [
{
"address_components": [
{
"long_name": "Angamaly",
"short_name": "Angamaly",
"types": [
"locality",
"political"
]
},
{
"long_name": "Ernakulam",
"short_name": "Ernakulam",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "Kerala State",
"short_name": "Kerala State",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "India",
"short_name": "IN",
"types": [
"country",
"political"
]
}
],
"formatted_address": "Angamaly, Kerala State, India",
"geometry": {
"bounds": {
"northeast": {
"lat": 10.2464704,
"lng": 76.39544959999999
},
"southwest": {
"lat": 10.1585335,
"lng": 76.3500451
}
},
"location": {
"lat": 10.212894,
"lng": 76.380601
},
"location_type": "APPROXIMATE",
"viewport": {
"northeast": {
"lat": 10.2464704,
"lng": 76.39544959999999
},
"southwest": {
"lat": 10.1585335,
"lng": 76.3500451
}
}
},
"types": [
"locality",
"political"
]
}
],
"status": "OK"
}
我需要該地點的經度和緯度。如何從
幾何性質 - > bounds->東北檢索LAT和LNG?
請看我的答案,測試和工作。 –
已解決? –
謝謝........... :) – raksuj