首页 / 浏览问题 / 三维GIS / 问题详情
webGL如何根据坐标点添加多边形
68EXP 2021年04月02日
viewer.entities.add({

            position: Cesium.Cartesian3.fromDegrees(81, 39,30.0),

            label: { //文字标签

                      text: "面积:"+area+"平方千米",

                      font: '500 30px Helvetica',// 15pt monospace

                      scale: 0.5,

                      style: Cesium.LabelStyle.FILL,

                      fillColor: Cesium.Color.WHITE,

                      pixelOffset: new Cesium.Cartesian2(-8, -35),   //偏移量

                      showBackground: true,

                      backgroundColor: new Cesium.Color(0.5, 0.6, 1, 1.0)

                  },

             polygon: {

              positions: {
        cartographicDegrees: [
          81.6943359375, 38.91357287764549, 100, 94.2626953125, 37.99072265625, 100, 93.1640625, 27.883298099040985, 100, 78.2666015625, 24.367673099040985, 100
        ],
      },

            },

          });

          

        });

我是这样画的,但是画不出来,是否有示例

1个回答

您好,类似于这样的:

viewer.entities.add({
                polygon: {
                    hierarchy: [{x: -2179173.6248775073, y: 4380554.24140956, z: 4091791.297742438}, {x: -2179517.9298555637, y: 4379862.870050267, z: 4092332.813300941}, {x: -2179815.670921358, y: 4380450.821211974, z: 4091562.599614238}, {x: -2179389.486197441, y: 4380634.26631488, z: 4091576.278342084}],
                    material: Cesium.Color.CYAN.withAlpha(0.5),
                    // outline: false,
                    height: 10
                },
1,509EXP 2021年04月02日
...