Google maps GooglePlacesAPI和GoogleMaps站点的结果不一样

Google maps GooglePlacesAPI和GoogleMaps站点的结果不一样,google-maps,google-places-api,Google Maps,Google Places Api,我为此工作了两天,不知道发生了什么 我在谷歌地图上的地址附近找Phamacy farmácia loc:R.Manoel Bandeira,324-490,Embu-圣保罗,06846-570,巴西 如你所见,5公里附近有很多药店 当我尝试在我的网站上使用GooglePlacesAPI时。结果是什么都没有。 遵守守则 有什么想法吗 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <

我为此工作了两天,不知道发生了什么

我在谷歌地图上的地址附近找Phamacy farmácia loc:R.Manoel Bandeira,324-490,Embu-圣保罗,06846-570,巴西

如你所见,5公里附近有很多药店

当我尝试在我的网站上使用GooglePlacesAPI时。结果是什么都没有。 遵守守则 有什么想法吗

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false&language=se"></script>
<script>

function init() {

const location=new google.maps.LatLng(-23.6334282, -46.8739405);
const radius = 5000;

// Make map
var mapOptions = {
center: location,
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map'), mapOptions);

// Make a circle
var circOptions={
center: location,
radius: radius,
map: map
};
circle = new google.maps.Circle(circOptions);  

// Get shops in radius
service = new google.maps.places.PlacesService(map);
var request={                                               //my request
location: location,
radius: radius,
types: ["pharmacy"]
};

service.search(request, function (results, status){
if (status == google.maps.places.PlacesServiceStatus.OK){
for (var i= 0, result; result=results[i]; i++) {     //add markers
distance=google.maps.geometry.spherical.computeDistanceBetween(location, result.geometry.location);
if (distance>radius)
continue;

var marker = new google.maps.Marker({
map: map,
position: result.geometry.location,
reference: result.reference
});
}
}
});

}
google.maps.event.addDomListener(window, 'load', init);

</script>

<style>#map {height: 500px;width: 500px;}</style>
</head>
<body><div id="map"></div></body>
</html>

函数init(){
const location=new google.maps.LatLng(-23.6334282,-46.8739405);
常数半径=5000;
//制作地图
变量映射选项={
中心:位置,
缩放:11,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
var map=new google.maps.map(document.getElementById('map'),mapOptions);
//绕一圈
风险值循环期权={
中心:位置,
半径:半径,
地图:地图
};
圆圈=新的google.maps.circle(圆圈选项);
//在半径范围内找到商店
服务=新的google.maps.places.PlacesService(地图);
var request={//my request
地点:地点,,
半径:半径,
类型:[“药房”]
};
服务搜索(请求、功能(结果、状态){
if(status==google.maps.places.PlacesServiceStatus.OK){
对于(vari=0,result;result=results[i];i++){//添加标记
距离=google.maps.geometry.sphereal.ComputedDistanceBeween(位置、结果、几何体、位置);
如果(距离>半径)
继续;
var marker=new google.maps.marker({
地图:地图,
位置:result.geometry.location,
参考:result.reference
});
}
}
});
}
google.maps.event.addDomListener(窗口'load',init);
#地图{高度:500px;宽度:500px;}

似乎找到了。谢谢!!!现在它开始工作了。是否有一种方法可以使用选项rankBy:google.maps.places.rankBy.DISTANCE对结果进行排序。我想得到最近的位置(我不需要半径)。可能吗?