【PowerQuery专栏】Table.SelectRows 进行条件筛选

Table.SelectRows函数的功能是基于条件筛选当前的数据,函数包含以下参数:

  • 参数1为表数据,数据类型为表,值为需要进行筛选的表
  • 参数2为条件列,数据类型为函数类型,值为条件匹配方法

函数的结果为表数据,图为函数参数。

  • Table.SelectRows(table as table,condition as function)

函数的功能就是基于当前的函数来进行数据的匹配筛选,下面这个案例就是非常典型的使用方法,这里筛选了性别为女的学生信息,图为函数执行结果。

  • 源 = #table(
在 Cesium 中实现点聚合功能主要依赖于 `Cesium.GeoJsonDataSource` 提供的数据加载和聚合机制。通过设置聚合参数并绑定事件处理,可以动态控制聚合行为和图标展示,从而提升大规模点数据的可视化效果。 ### 实现步骤 1. **创建数据源并加载 GeoJSON 数据** 首先使用 `Cesium.GeoJsonDataSource` 加载本地或远程的 GeoJSON 数据文件。该数据源支持聚合功能,适用于大规模点数据的渲染优化。 ```javascript const geoJsonDataSource = new Cesium.GeoJsonDataSource(); this.viewer.dataSources.add(geoJsonDataSource); geoJsonDataSource.load('static/data/cluserPoint.json'); ``` 2. **启用聚合功能** 在数据加载完成后,启用聚合功能并设置相关参数,例如聚合像素范围和最小聚合点数。 ```javascript geoJsonDataSource.clustering.enabled = true; geoJsonDataSource.clustering.pixelRange = 15; // 聚合像素范围 geoJsonDataSource.clustering.minimumClusterSize = 3; // 最小聚合数量 ``` 3. **设置聚合图标** 聚合图标可以根据聚合点数量动态设置,提升可视化效果。通过 `setClusterEvent` 方法绑定事件,根据聚合点数量设置不同的图标。 ```javascript this.setClusterEvent(geoJsonDataSource); ``` 其中 `setClusterEvent` 方法可自定义,示例如下: ```javascript setClusterEvent(dataSource) { dataSource.clustering.clusterEvent.addEventListener((clusteredEntities, cluster) => { cluster.label.text = clusteredEntities.length.toString(); cluster.billboard.image = 'static/images/cluster-icon.png'; // 设置聚合图标 }); } ``` 4. **手动设置高度信息** 如果数据源中的点数据包含高度信息(Z 值),在加载完成后需要手动更新实体的高度值,因为默认情况下 GeoJSON 数据源不会自动解析高度信息[^2]。 ```javascript geoJsonDataSource.entities.values.forEach(entity => { if (entity._properties && entity._properties.Z) { const cartographic = Cesium.Cartographic.fromCartesian(entity.position._value); const longitude = Cesium.Math.toDegrees(cartographic.longitude); const latitude = Cesium.Math.toDegrees(cartographic.latitude); const height = Number(entity._properties.Z._value); entity.position = Cesium.Cartesian3.fromDegrees(longitude, latitude, height); } }); ``` 5. **设置实体图标** 对于非聚合状态下的实体,可以统一设置图标,例如使用摄像头图标表示特定类型的点。 ```javascript entity.billboard.image = 'static/images/blueCamera.png'; entity.type = "cluser"; ``` ### 效果与优化 - **动态图标展示**:根据聚合点数量动态切换图标样式,提升用户交互体验。 - **性能优化**:大规模点数据渲染时,聚合功能可以显著减少屏幕上的实体数量,提高性能[^3]。 - **高度信息处理**:确保点数据在三维空间中的正确位置,避免因高度缺失导致的渲染偏差。 ### 示例代码整合 ```javascript initCluster() { const geoJsonDataSource = new Cesium.GeoJsonDataSource(); this.viewer.dataSources.add(geoJsonDataSource); geoJsonDataSource.load('static/data/cluserPoint.json').then(() => { geoJsonDataSource.clustering.enabled = true; geoJsonDataSource.clustering.pixelRange = 15; geoJsonDataSource.clustering.minimumClusterSize = 3; this.setClusterEvent(geoJsonDataSource); geoJsonDataSource.entities.values.forEach(entity => { entity.billboard.image = 'static/images/blueCamera.png'; entity.type = "cluser"; if (entity._properties && entity._properties.Z) { const cartographic = Cesium.Cartographic.fromCartesian(entity.position._value); const longitude = Cesium.Math.toDegrees(cartographic.longitude); const latitude = Cesium.Math.toDegrees(cartographic.latitude); const height = Number(entity._properties.Z._value); entity.position = Cesium.Cartesian3.fromDegrees(longitude, latitude, height); } }); }); } ``` 通过上述步骤,可以实现在 Cesium 中对点数据的聚合处理,并结合图标和高度信息优化三维可视化效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

雾岛心情

欢迎你的打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值