• geoscene/smartMapping
    • labels

bins

AMD: require(["geoscene/smartMapping/labels/bins"], (binLabelCreator) => { /* code goes here */ });
ESM: import * as binLabelCreator from "@geoscene/core/smartMapping/labels/bins.js";
对象: geoscene/smartMapping/labels/bins
起始版本:GeoScene Maps SDK for JavaScript 4.27

此对象包含一个辅助方法,用于生成要在图层的图格化配置上进行设置的默认标注。默认标注基于 FeatureReductionBinning.renderer。在大多数情况下,默认标注配置将是图格中的要素总数。该值将被四舍五入并进行格式化 (例如,图格标注将显示 2.4k,而不是 2385)。

这包括可在图格上进行试用的次要标记方案。此模块仅适用于具有点几何类型的图层。

方法概述

名称 返回值类值 描述 对象
Promise<Schemes>

生成要在 FeatureLayer 的 featureReduction 属性中进行设置的默认 labelingInfo 方案。

更多详情
bins

方法详细说明

getLabelSchemes(params){Promise<Schemes>}

生成要在 FeatureLayer 的 featureReduction 属性中进行设置的默认 labelingInfo 方案。根据 FeatureReductionBinning 的渲染器返回一个或多个建议的 LabelClasses。

参数
规范
params Object

有关可能传递给此函数的每个参数的详细信息,请参阅下表。

规范

已启用或将启用图格化的点图层。

renderer Renderer
optional

启用图格化时,layer.featureReduction.renderer 上设置的渲染器。

返回
类型 描述
Promise<Schemes> 返回一个对象,其中包含要在图层的 featureReduction 属性上设置的建议的主要标注和次要标注方案。
示例
// Sets a suggested label scheme for the binning config based on its renderer
const { primaryScheme } = await binLabelCreator.getLabelSchemes({
  layer: featureLayer
});

const featureReduction = featureLayer.featureReduction.clone();
featureReduction.labelingInfo = primaryScheme.labelingInfo;
featureLayer.featureReduction = featureReduction;

类型定义

Scheme

包含要在图层的 featureReduction.labelingInfo 上设置的建议 labelingInfo。

属性
name String

生成的图格化标记方案的名称。这可在 web 地图创作应用程序的 UI 中使用。

fieldName String

标记方案中使用的聚合字段的名称。这可在 web 地图创作应用程序的 UI 中使用。

labelingInfo LabelClass[]

要在图层的 featureReduction.labelingInfo 属性上设置的一组 LabelClass 对象。

Schemes

getLabelSchemes() 方法返回的对象。

属性
primaryScheme Scheme

包括为输入图层的图格建议的主要标记方案。

secondarySchemes Scheme[]

包括为输入图层的图格建议的次要标记方案。

您的浏览器不再受支持。请升级您的浏览器以获得最佳体验。