PoiType
此枚举常量表示地点的类型。
常量
| 常量 | 描述 |
|---|---|
| BMAP_POI_TYPE_NORMAL | 一般位置点 |
| BMAP_POI_TYPE_BUSSTOP | 公交车站位置点 |
| BMAP_POI_TYPE_SUBSTOP | 地铁车站位置点 |
示例
ts
// 创建本地搜索实例
const localSearch = new BMapGL.LocalSearch(map);
// 监听搜索结果
localSearch.onSearchComplete = (results: BMapGL.LocalResult) => {
// 获取第一个POI结果
const poi = results.getPoi(0);
// 判断POI类型
switch (poi.type) {
case BMapGL.PoiType.BMAP_POI_TYPE_NORMAL:
console.log('这是一个一般位置点');
break;
case BMapGL.PoiType.BMAP_POI_TYPE_BUSSTOP:
console.log('这是一个公交车站');
// 注意:此时 poi.address 包含经过该站点的所有车次信息
break;
case BMapGL.PoiType.BMAP_POI_TYPE_SUBSTOP:
console.log('这是一个地铁站');
break;
}
};