前言
其实调用图层叠加是最好的方式,又省事。但是也记录一下前端自己生成的吧。
效果图如下:

1、具体代码
/**
* 经纬网实现
*/
import {
Color,
Cartographic,
Cartesian3,
PolylineCollection,
PolylineDashMaterialProperty
} from "cesium";
export class Graticules {
constructor(viewer, options) {
this.viewer = viewer;
this.lines = this.viewer.scene.primitives.add(new PolylineCollection());
this.color = Color.fromCssColorString("#ffffff").withAlpha(0.5);
this.width = options?.width ?? 1;
this.viewer.scene.globe.enableLighting = false; // 禁用灯光照射
// 隐藏默认的经纬网格
this.viewer.scene.globe.showGroundAtmosphere = false;
this.viewer.scene.globe.showWaterEffect = false;
// 移除 attribution 标志
this.viewer._cesiumWidget._credi

文章介绍了如何在Cesium中通过前端代码自动生成经纬网,包括绘制经线和纬线的函数,以及设置线条颜色、宽度和禁用灯光照射等细节。最终通过一个实例展示了如何在地图上渲染这些经纬线。

2275

被折叠的 条评论
为什么被折叠?



