AI 地图
产品服务
解决方案
文档与支持
定价
更新时间: 2026/07/27 10:37
您当前查看的是 JSAPI GL 历史版本文档。该版本仅用于维护现有项目,不建议用于新项目开发。新项目请使用 JSAPI 4.0,如需升级现有项目,请参考升级指南
You are viewing the legacy JSAPI GL documentation. This version is maintained for existing projects only and is not recommended for new development. For new projects, use the JSAPI 4.0 documentation. If you are upgrading an existing project, please refer to the Migration Guide.
3D棱柱
简介

JSAPI GL提供的Prism类支持在地图上添加3D棱柱功能,继承Overlay类,可以基于位置经纬度,高度,顶面和侧面的颜色、透明度等属性来绘制不规则的棱柱体。

Prism类参考

构造函数:

构造函数说明

BMapGL.Prism(points, altitude, options)

创建3D棱柱覆盖物,构造函数里需要定义底面和高度。

参数说明:

构造函数类型说明

points

Array< Point >

底面坐标数组

altitude

number

高度

options

Object

棱柱样式自定义配置,可选

options属性变量:

options属性类型说明

topFillColor

string

顶面填充颜色

topFillOpacity

number

顶面填充颜色透明度,取值范围0-1

sideFillColor

string

侧面填充颜色

sideFillOpacity

number

侧面填充颜色透明度,取值范围0-1

enableMassClear

boolean

是否在调用map.clearOverlays清除此覆盖物,默认为true

使用示例
1. 创建地图参照展示地图
2. 创建棱柱,并添加到地图上

Prism继承Overlay,使用方法同其他覆盖物,首先通过Prism类创建棱柱实例,然后通过map.addOverlay()将其添加到地图上。

var prism = new BMapGL.Prism(path, 5000, {
topFillColor: '#5679ea',
topFillOpacity: 0.5,
sideFillColor: '#5679ea',
sideFillOpacity: 0.9
});
map.addOverlay(prism);

上一篇

镂空面绘制

下一篇

地面叠加层
本篇文章对您是否有帮助?