2012-03-06 32 views
1

我想在我的項目中使用google API。 我得到的API是從hereGoogle API不能與其他經緯度一起使用

,API爲: - https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=5000&types=food&sensor=false&key=* ** * ** * ** * ** * ** * ** *

注意: - 我已經附加我在這個網址的結束鍵。它向我展示了適當的迴應。 但是,如果我改變古吉拉特邦(國家印度)的經度和緯度..然後它不顯示任何答覆。 而如果ZERO_RESULT

的迴應誰能幫助我爲什麼發生和如何解決它。

我這是想這樣做是爲了獲得當前latitide經度附近的信息.. 是否有任何其他方式或API來獲取附近區域的信息.. 請幫助我.. 謝謝推進

+1

請你能提供你正在使用的古吉拉特邦的經緯度嗎? – 2012-03-06 05:26:17

+0

即將使用的古吉拉特邦,艾哈邁達巴德的緯度和經度是緯度= 23.00和經度= 72.00 – 2012-03-06 05:30:16

+2

[Google Places API不會爲印度返回任何結果]的可能重複(http://stackoverflow.com/questions/9477512/google- api-not-returning-any-results-for-india) – 2012-03-06 06:43:07

回答

1

我用這個片段,並適用於所有情況。

<body> 
<div id="mainpanel" style="float:left; background-color:#fff; width:75%;"> 
    <div style="display:none;" id="lat">hhh</div><div style="display:none;" id="lon">hhh</div> 


<script> 
var x=document.getElementById("lat"); 
var y=document.getElementById("lon"); 
function getLocation() 
    { 
    if (navigator.geolocation) 
    { 
    navigator.geolocation.getCurrentPosition(showPosition); 
    } 
    else{x.innerHTML="Geolocation is not supported by this browser.";} 
    } 
function showPosition(position) 
    { 
    x.innerHTML=position.coords.latitude; 
    y.innerHTML=position.coords.longitude; 
    loadScript(); 
    } 

function initialize() 
{ 
var xval=document.getElementById("lat").innerHTML; 
var yval=document.getElementById("lon").innerHTML; 
var mapProp = { 
    center: new google.maps.LatLng(xval,yval), 
    zoom:7, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
    }; 
    var map = new google.maps.Map(document.getElementById("googleMap"),mapProp); 
} 

function loadScript() 
{ 
    var script = document.createElement("script"); 
    script.type = "text/javascript"; 
    script.src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false&callback=initialize"; 
    document.body.appendChild(script); 
} 
//window.onload = loadScript; 
</script> 
    <form> 
     <input class="boxinput" type="text" class="form-control" placeholder="Phone" id="" name=""/> 
     </form> 
    <div class="serchbox"></div> 
    <div id="googleMap" style="width:960px;height:804px;"></div> 

    </div> 
    </body> 
相關問題