81,091
社区成员
发帖
与我相关
我的任务
分享
//中心点坐标
var cpoint = new AMap.LngLat(121.472644, 31.231706);
function mapInit() {
//加载地图
mapObj = new AMap.Map("iCenter");
}
//地点查询函数
function placeSearch(page,distinct) {
if(distinct != null){
console.log(distinct[0]);
console.log(distinct[1]);
cpoint = new AMap.LngLat(distinct[0],distinct[1]);
}
//加载服务插件,实例化地点查询类
mapObj.plugin(["AMap.PlaceSearch"], function() {
MSearch = new AMap.PlaceSearch({
city: "南京",
pageSize: 50,
pageIndex: page
});
//查询成功时的回调函数
AMap.event.addListener(MSearch, "complete", placeSearch_CallBack);
AMap.event.addListener(MSearch, "error", placeSearch_CallBack_Error);
MSearch.searchNearBy("餐饮", cpoint, 50000);
});
}
去看看对应的API就清楚了,我上面是个列子