Boundary
方法
返回行政区域的边界。 name: 查询省、直辖市、地级市、或县的名称。 callback:执行查询后,数据返回到客户端的回调函数,数据以回调函数的参数形式返回。返回结果是一个数组,数据格式如下: arr[0] = "x1, y1; x2, y2; x3, y3; ..." arr[1] = "x1, y1; x2, y2; x3, y3; ..." arr[2] = "x1, y1; x2, y2; ..." … 否则回调函数的参数为null
参数 类型 说明 namestringcallback(result: BoundaryResult) => void返回值 void
示例代码1
const boundary = new BMap.Boundary();
boundary.get('北京市', (rs) => {
const polygons = rs.boundaries.map((b) => new BMap.Polygon(b, { strokeWeight: 2 }));
polygons.forEach((p) => map.addOverlay(p));
});
解析混淆后的百度坐标字符串
参数 类型 说明 strstring混淆后的百度坐标字符串 callback(result: BoundaryResult) => void解析完成后的回调函数,返回 BoundaryResult 返回值 void
此类表示一个行政区域的边界。