【问题标题】:ESRI Js API 4.15 : FeatureLayer labels are not visible on all featuresESRI Js API 4.15:FeatureLayer 标签在所有功能上不可见
【发布时间】:2021-08-27 16:06:19
【问题描述】:

我正在尝试在一个点FeatureLayer上显示标签,该标签仅对一个Feature不可见,但是当地图更改比例时它变得可见,有什么解释吗?

这是我的代码:

 "renderer": {
                    "type": "class-breaks",
                    "field": "nums",
                    "classBreakInfos": [
                        {
                            "minValue": 0,
                            "maxValue": 9,
                            "label": " < 10",
                            "symbol": {
                                "type": "picture-marker",
                                "url": "./assets/picto/nums/vert.png",
                                "width": 30,
                                "height": 50
                            }
                        },
                        {
                            "minValue": 10,
                            "maxValue": 19,
                            "label": " 10 à 19",
                            "symbol": {
                                "type": "picture-marker",
                                "url": "./assets/picto/nums/orange.png",
                                "width": 30,
                                "height": 50
                            }
                        },
                        {
                            "minValue": 20,
                            "maxValue": 1000000,
                            "label": " > 19",
                            "symbol": {
                                "type": "picture-marker",
                                "url": "./assets/picto/nums/rouge.png",
                                "width": 30,
                                "height": 50
                            }
                        }
                    ]
                },
"labelingInfo": [
                    {
                        "labelExpressionInfo": {
                            "expression": "$feature.nums"
                        },
                        "labelPlacement": "center-center",
                        "symbol": {
                            "type": "text",
                            "color": "black",
                            "haloColor": "white",
                            "xoffset": -2,
                            "yoffset": 13,
                            "font": {
                                "size": 7,
                                "family": "sans-serif",
                                "weight": "bolder"
                            }
                        }
                    }
                ]

我加入了一张FeatureLayer标签问题的图片:

【问题讨论】:

    标签: label layer arcgis-js-api


    【解决方案1】:

    根据您的定义,您使用的是默认解除冲突策略(“静态”)。有时当发生重叠时,重叠的标签不会显示。这个策略是否有意义取决于具体情况。

    您可以尝试“无”选项来关闭消除冲突,您应该不会遇到这个问题。看来这可能是您正在寻找的。​​p>

    labelClass.deconflictionStrategy = "none";
    

    ArcGIS JS API - LabelClass deconflictionStrategy

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-03
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-07
      相关资源
      最近更新 更多