Skip to content

KBE3D / KBCore / layers / GeojsonLayerLoadOptions

接口: GeojsonLayerLoadOptions

继承于

属性

source?

optional source: string | Record<string, any> | Resource | Promise<Record<string, any>> | (...args: any[]) => Record<string, any>

geojson数据的URL 或 geojson数据对象 或 一个返回geojson数据对象的Promise 或 是一个返回geojson数据对象方法 或 Cesium.Resource请求对象


keepOldSource?

optional keepOldSource: boolean

是否保留地球上已经加载的数据,默认为false


opacity?

optional opacity: number

图层透明度, 0~1,默认为1


markerSize?

optional markerSize: number

为每个点创建的地图图钉的默认大小,以像素为单位,默认为 48


markerSymbol?

optional markerSymbol: string

为每个点创建的地图图钉的默认符号,默认为 undefined 可接受如下格式的图片数据:

  1. 前端项目public目录下的静态资源

Examples

 markerSymbol: '/assets/demo.png',
  1. 前端项目src或其他目录下的资源动态引入
// vite示例
 markerSymbol: (await import('@/assets/demo.png')).default,
 // webpack示例
 markerSymbol: require('@/assets/demo.png'),
  1. 前缀为 "data:" 协议的字符串URI
 markerSymbol: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNby...',

markerColor?

optional markerColor: string | Color | (...args: any[]) => string | Color | undefined

为每个点创建的地图图钉的默认颜色,默认为 Cesium.Color.ROYALBLUE 可以是css颜色值、Cesium.Color对象或函数,用于生成颜色


outline?

optional outline: string | Color | (...args: any[]) => string | Color | undefined

折线和多边形轮廓的默认颜色,默认为 Cesium.Color.GREEN 可以是css颜色值、Cesium.Color对象或函数,用于生成颜色


outlineWidth?

optional outlineWidth: number

折线和多边形轮廓的默认宽度,默认为 1


fill?

optional fill: string | Color | (...args: any[]) => string | Color | undefined

多边形内部的默认颜色,默认为 Cesium.Color.YELLOW,如需调整透明度,请通过opacity属性进行设置,在这里设置无效 可以是css颜色值、Cesium.Color对象或函数,用于生成颜色


clampToGround?

optional clampToGround: boolean

是否要将几何特征(多边形或线串)固定在地面上,默认为false


label?

optional label: { textField: string; constructorOptions?: ConstructorOptions; }

文字标注构造,不传值或设置为false将不会启用

textField

textField: string

指定文本在geojson数据properties属性中的字段名,支持显式换行符“\n”

constructorOptions?

optional constructorOptions: ConstructorOptions

label构造器参数类型

默认值
ts
{
   // Cesium default
   show: true,
   font: '30px sans-serif',
   style: Cesium.LabelStyle.FILL,
   scale: 1,
   showBackground: false,
   backgroundColor: new Cesium.Color(0.165, 0.165, 0.165, 0.8),
   backgroundPadding: new Cesium.Cartesian2(7, 5),
   pixelOffset: Cesium.Cartesian2.ZERO,
   eyeOffset: Cesium.Cartesian3.ZERO,
   horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
   verticalOrigin: Cesium.VerticalOrigin.CENTER,
   heightReference: Cesium.HeightReference.NONE,
   fillColor: Cesium.Color.WHITE,
   outlineColor: Cesium.Color.BLACK,
   outlineWidth: 1,
   // custom settings
   scaleByDistance: new Cesium.NearFarScalar(1000, 1, 80000, 0.5),
 }

KBE3D @3.0.0 Copyright © 2024-present KBE3D