第1行: | 第1行: | ||
− | + | {{jspopularGL-sidebar}} | |
+ | <div class="h1-title">简易行政区划图层</div><div id="update-time">更新时间:2022年3月12日</div><div class="bluetitle"><div class="services-title-text">简介</div></div><div class="serve-explain-text">DistrictLayer图层,使用获取的新版行政区划数据进行行政区划图层展示,支持多级行政区划的获取与展示,并提供了特色的行政区合并大区功能。</div><!--jsapi单独demo-代码--><div class="jsapidemo_template"><div class="demo_area"><div dir="https://lbsyun.baidu.com/jsdemo/demo/eMarker3d.htm"></div></div><div class="demo_control"><div class="demo_btn" style="width:50%;">[https://lbsyun.baidu.com/jsdemo/demo/DistrictLevel.htm 多级省区]</div><div class="demo_btn" style="width:485px;">[https://lbsyun.baidu.com/jsdemo/demo/DistrictBigLoc.htm 行政大区]</div></div><div class="jsapi-demo-link">[http://lbsyun.baidu.com/jsdemo.htm#eMarker3d DEMO详情]</div></div><div class="bluetitle"><div class="services-title-text">Marker3D类参考</div></div><div class="serve-explain-text"> | ||
+ | 构造函数: | ||
+ | </div> | ||
+ | {| width="519" border="1" | ||
+ | |- | ||
+ | | width="104" | '''构造函数''' | ||
+ | | width="297" | '''说明''' | ||
+ | |- | ||
+ | | BMapGL.DistrictLayer(options, callback) | ||
+ | | 行政区划聚合图层构造函数 | ||
+ | |} | ||
+ | <div class="serve-explain-text"> | ||
+ | 参数说明: | ||
+ | </div> | ||
+ | {| width="519" border="1" | ||
+ | |- | ||
+ | | width="104" | '''构造函数''' | ||
+ | | width="90" | '''类型''' | ||
+ | | width="297" | '''说明''' | ||
+ | |- | ||
+ | | options | ||
+ | | Object | ||
+ | | 行政区划图层样式配置对象 | ||
+ | |- | ||
+ | | callback | ||
+ | | Function | ||
+ | | 回调函数 | ||
+ | |} | ||
+ | <div class="serve-explain-text"> | ||
+ | options属性变量: | ||
+ | </div> | ||
+ | {| width="519" border="1" | ||
+ | |- | ||
+ | | width="104" | '''options属性''' | ||
+ | | width="90" | '''类型''' | ||
+ | | width="297" | '''说明''' | ||
+ | |- | ||
+ | | name | ||
+ | | Array | ||
+ | | 欲获取的行政区划名称,格式为字符串或数组。如果是大区情况,只能采用字符串格式,如"(北京,天津,河北),山东" | ||
+ | |- | ||
+ | | kind | ||
+ | | number | ||
+ | | 行政区划显示级别,0为省级行政区划,1为市级行政区划,2为区级行政区划 | ||
+ | |- | ||
+ | | strokeColor | ||
+ | | string | ||
+ | | 描边颜色,默认为'#ff0' | ||
+ | |- | ||
+ | | strokeOpacity | ||
+ | | number | ||
+ | | 描边线粗细,默认为1 | ||
+ | |- | ||
+ | | strokeWeight | ||
+ | | number | ||
+ | | 点的纹理贴图,格式为通过Icon创建的Icon对象 | ||
+ | |- | ||
+ | | fillColor | ||
+ | | string | ||
+ | | 填充颜色,默认为'#00f'。格式为字符串或数组。注意,目前行政区划没有名称标识,数组颜色与返回子层级区域顺序一一对应,暂不支持对子层级的特定市区县设置指定颜色。 | ||
+ | |} | ||
+ | <div class="bluetitle"><div class="services-title-text">使用示例</div></div><div class="devguide"><div class="leftborderbg" style="height:5000px;"></div><div class="devguideorder"><span>1</span>创建地图参照展示地图</div><div class="devguidecenter"></div><div class="devguideorder"><span>2</span>创建带高度的点,并添加到地图上</div><div class="devguidecenter">创建带高度的点使用BMapGL.Marker3D类,其继承自Overlay,通过map.addoverlay()方法将创建的点覆盖物添加到地图上。<pre class="prettyprint codestyle"> // 创建位置点 | ||
var point = new BMapGL.Point(116.404, 39.915); | var point = new BMapGL.Point(116.404, 39.915); | ||
// 创建带高度的点 | // 创建带高度的点 |
2022年5月30日 (一) 16:17的版本
简易行政区划图层
更新时间:2022年3月12日
简介
DistrictLayer图层,使用获取的新版行政区划数据进行行政区划图层展示,支持多级行政区划的获取与展示,并提供了特色的行政区合并大区功能。
Marker3D类参考
构造函数:
构造函数 | 说明 |
BMapGL.DistrictLayer(options, callback) | 行政区划聚合图层构造函数 |
参数说明:
构造函数 | 类型 | 说明 |
options | Object | 行政区划图层样式配置对象 |
callback | Function | 回调函数 |
options属性变量:
options属性 | 类型 | 说明 |
name | Array | 欲获取的行政区划名称,格式为字符串或数组。如果是大区情况,只能采用字符串格式,如"(北京,天津,河北),山东" |
kind | number | 行政区划显示级别,0为省级行政区划,1为市级行政区划,2为区级行政区划 |
strokeColor | string | 描边颜色,默认为'#ff0' |
strokeOpacity | number | 描边线粗细,默认为1 |
strokeWeight | number | 点的纹理贴图,格式为通过Icon创建的Icon对象 |
fillColor | string | 填充颜色,默认为'#00f'。格式为字符串或数组。注意,目前行政区划没有名称标识,数组颜色与返回子层级区域顺序一一对应,暂不支持对子层级的特定市区县设置指定颜色。 |
使用示例
1创建地图参照展示地图
2创建带高度的点,并添加到地图上
创建带高度的点使用BMapGL.Marker3D类,其继承自Overlay,通过map.addoverlay()方法将创建的点覆盖物添加到地图上。
// 创建位置点 var point = new BMapGL.Point(116.404, 39.915); // 创建带高度的点 var marker3d = new BMapGL.Marker3D(point, 8000, { size: 50, shape: BMAP_SHAPE_CIRCLE, fillColor: '#454399', fillOpacity: 0.6 }); // 将点添加到地图上 map.addOverlay(marker3d);
纹理贴图
1贴纹理
纹理图片首先需要通过Icon类创建实例,然后通过Marker3D类创建带高度的点实例时,将得到的Icon实例传给icon属性。
// 创建位置点 var pt = new BMapGL.Point(point.lng, point.lat); // 创建贴图纹理Icon var icon = new BMapGL.Icon(citys[i].img, new BMapGL.Size(40, 40)); // 创建带高度的点,这里只需要size和icon var marker = new BMapGL.Marker3D(pt, 8000, { size: 80, icon: icon }); // 将点添加到地图上 map.addOverlay(marker);