GraphicsOverlay labels in 100.15

612
3
Jump to solution
09-21-2022 11:26 PM
FatmaAkdemir
Occasional Contributor II

Currently we upgraded our applications from 100.8 to 100.15 and we saw that labels are not always visible regardless of zoom in/out. How can we make labels visible always? We create our LabelDefinition with a JSON expression.

0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

By default, labeling will attempt to place (show) as many labels as possible based on the rules/properties you set, but if they cannot be placed because they would overlap, then they will not be placed.

Instead, to always place labels regardless of overlaps, you should set the LabelDefinition class property LabelDeconflictionStrategy to either:

LabelDeconflictionStrategy::None : The label will be placed in the preferred location, regardless of overlaps with other features, graphics, or labels.

LabelDeconflictionStrategy::DynamicNeverRemove : The label will be placed in the preferred location, but may be moved to an alternative location to minimize overlapping higher priority labels or feature/graphic symbols.

For more info see:

<LabelingTypes.h> - Collection of Labeling Enums | ArcGIS Runtime API for Qt | ArcGIS Developers

LabelDefinition Class | ArcGIS Runtime API for Qt | ArcGIS Developers

 

View solution in original post

0 Kudos
3 Replies
MichaelBranscomb
Esri Frequent Contributor

Can you share your current JSON label definition?

Note ArcGIS Runtime now has a full API for labeling, we recommend migrating from your JSON definition to using the API types. For more info see LabelDefinition Class | ArcGIS Runtime API for Qt | ArcGIS Developers

0 Kudos
FatmaAkdemir
Occasional Contributor II

Hi @MichaelBranscomb ,

JSON label definition is below:

const QString labelJsonMgr(R"({"labelExpressionInfo":{"expression":"$feature.text"},"labelPlacement":"esriServerPointLabelPlacementAboveCenter","symbol":{"angle":0,"backgroundColor":[0,0,0,0],"borderLineColor":[0,0,0,0],"borderLineSize":0,"color": [255,0,0,255],"font":{"decoration":"none","size":8,"style":"normal","weight":"normal"},"haloColor":[0,0,0,0],"haloSize":0,"horizontalAlignment":"Left","kerning":false,"type":"esriTS","verticalAlignment":"bottom","xoffset":0,"yoffset":0}})");

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

By default, labeling will attempt to place (show) as many labels as possible based on the rules/properties you set, but if they cannot be placed because they would overlap, then they will not be placed.

Instead, to always place labels regardless of overlaps, you should set the LabelDefinition class property LabelDeconflictionStrategy to either:

LabelDeconflictionStrategy::None : The label will be placed in the preferred location, regardless of overlaps with other features, graphics, or labels.

LabelDeconflictionStrategy::DynamicNeverRemove : The label will be placed in the preferred location, but may be moved to an alternative location to minimize overlapping higher priority labels or feature/graphic symbols.

For more info see:

<LabelingTypes.h> - Collection of Labeling Enums | ArcGIS Runtime API for Qt | ArcGIS Developers

LabelDefinition Class | ArcGIS Runtime API for Qt | ArcGIS Developers

 

0 Kudos