我需要获取谷歌地图上某一点附近的城市、城镇、社区等信息。我使用了谷歌Places服务,但只能获取到酒店、商店等信息,而无法得到政治位置。
例如,尝试在一个10000米半径范围内获取巴黎(100 rue de la Parcheminerie, 75005 PARIS)的所有政治位置。
你只会得到一个结果:巴黎[本地性,政治]类型,没有其他社区、城镇、城市等信息。
然后,尝试使用100000米半径,但是没有结果。
示例代码:
顺便说一下,我已经设置了政治类型。
例如,尝试在一个10000米半径范围内获取巴黎(100 rue de la Parcheminerie, 75005 PARIS)的所有政治位置。
你只会得到一个结果:巴黎[本地性,政治]类型,没有其他社区、城镇、城市等信息。
然后,尝试使用100000米半径,但是没有结果。
示例代码:
//vars map, centerPoint, radius was previously set
function getPlacesOnRadius() {
var request = {
location: centerPoint,
radius: radius * 1000,
types: ['political']
};
var service = new google.maps.places.PlacesService(map);
service.search(request, callback);
}
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
var place = results[i];
//createMarker(results[i]);
}
}
}
顺便说一下,我已经设置了政治类型。