2012-03-06 48 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>