Constructor
new GeojsonLayer(viewer, opt)
Example
let geojsonLayer = new GeojsonLayer(viewer,{
show: false,
url: "data/area.json",
alpha: 0.5,
style: {
point: {
color: "#00FFFF",
colorAlpha: 1,
outlineWidth: 1,
outlineColor: "#000000",
outlineColorAlpha: 1,
pixelSize: 20,
},
polyline: {
color: "#FFFF00",
colorAlpha: 1,
width: 3,
clampToGround: 1,
},
polygon: {
heightReference: 1,
fill: true,
color: {
conditions: "random",
type: "color", // 随机数返回值类型 number / color(16进制颜色)
},
"color": { // 支持多种方式赋值
"field": "name",
"conditions": [
['${name} >= "东部战区"', '#000000'],
['true', 'color("blue")']
]
},
"color":{
"field" : "name",
"conditions" : "random" , // 可不填
}
colorAlpha: 1,
outline: true,
outlineWidth: 1,
outlineColor: "#FFFF00",
outlineColorAlpha: 1,
},
},
tooltip: [
{
field: "name",
fieldName: "名称",
},
{
field: "ADCODE99",
fieldName: "编号",
},
];
geojsonLayer.load();
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
viewer |
Cesium.viewer | 地图viewer对象 | ||||||||||||||||
opt |
Object | 基础配置
Properties
|
Extends
Members
_layer
- Overrides:
Properties:
Name | Type | Description |
---|---|---|
layer |
Cesium.ImageryLayer | 图层 |
_provider
- Overrides:
Properties:
Name | Type | Description |
---|---|---|
provider |
Cesium.ImageryProvider | 图层 |
dataSources
Properties:
Name | Type | Description |
---|---|---|
_layer |
Cesium.CustomDataSource | entity集合 |
id
- Overrides:
Properties:
Name | Type | Description |
---|---|---|
id |
String | Number | 图层id |
imageryLayerAttr
- Overrides:
Properties:
Name | Type | Description |
---|---|---|
imageryLayerAttr |
Object | imageryLayer相关配置 |
providerAttr
- Overrides:
Properties:
Name | Type | Description |
---|---|---|
providerAttr |
Object | provider相关配置 |
style
Properties:
Name | Type | Description |
---|---|---|
style |
Object | 要素样式 |
style
Properties:
Name | Type | Description |
---|---|---|
style |
Object | 要素样式 |
type
Properties:
Name | Type | Description |
---|---|---|
type |
String | 类型 |
type
Properties:
Name | Type | Description |
---|---|---|
type |
String | 类型 |
Methods
createPoint(alpha)
- Description:
- 设置透明度
Parameters:
Name | Type | Description |
---|---|---|
alpha |
Number | 透明度(0~1) |
hide()
- Description:
- 隐藏
- Overrides:
hide()
- Description:
- 隐藏
- Overrides:
load(fun)
- Description:
- 图层加载
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
fun |
loadcallback | 加载完成后的回调函数 |
load(fun)
- Description:
- 图层加载
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
fun |
loadcallback | 加载完成后的回调函数 |
remove()
- Description:
- 移除
- Overrides:
remove()
- Description:
- 移除
- Overrides:
setAlpha(alpha)
- Description:
- 设置透明度
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
alpha |
Number | 透明度(0~1) |
setVisible(visible)
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
visible |
Boolean | 是否显示 |
show()
- Description:
- 展示
- Overrides:
show()
- Description:
- 展示
- Overrides:
zoomTo()
- Description:
- 缩放至图层
- Overrides:
zoomTo()
- Description:
- 缩放至图层
- Overrides: