我要做一个搜索附近poi的功能,按照种类分,比如商店、银行、医院、景点...
image.png
点击银行,就按照距离最近的还是排列,如下
image.png
用的高德api 申请的是web服务
let myUrl ="https://restapi.amap.com/v3/place/around?key=77d509de59039cd6062b56bcbdf470ad&radius=3000&offset=60&page=1&extensions=all";
let that = this;
var url_my = myUrl + '&location=104.027662,30.626221' +'&keywords=' + "银行";
this.http.get(url_my).subscribe(
function(res){
var mydata = res.json();
let count = mydata.count;
if(count==0){
alert("周边三公里未找到此poi信息!");
}
else{
console.log(mydata.pois);
let data:Object = {
'poi':mydata.pois,
'poi_type':name
};
that.navCtrl.push(AroundContentPage,data);
}
console.log(mydata);
},function(err){
var errdata = err.json();
console.log("信息:"+errdata.message);
});
网友评论