3D Labels Disappearing & Vertical Offset Property Not Working In 4.4

4444
7
Jump to solution
07-25-2017 11:40 AM
AndrewLindley
New Contributor III

*** This is now fixed as of 4.5! ***

   I've noticed some weird behavior with the LabelSymbol3D labels that I've added to my Scene View. They look good on load and from a zoomed-out scale, but when you zoom closer into the individual polygons that are being labeled, the labels flicker and eventually disappear, but only for certain polygons.

   This behavior is fixed if I remove the 'world-elevation' layer from the map's ground property, making the surface completely flat. My first instinct was to increase the vertical offset of the labels using the 'verticalOffset' property available for LabelSymbol3D features, but changing the 'screenLength' property of the vertical offset yields no changes in the view. 

   Here is a snippet of my code for reference. The labels load fine, but I cannot resolve the problems mentioned above.

var featureLayerLabels = new LabelClass({

   labelExpressionInfo: {
      value: "{padId}"
   },
   symbol: new LabelSymbol3D({
      symbolLayers: [new TextSymbol3DLayer({
         halo: {
            color: "black",
            size: 1
         },
         material: {
              color: [250, 203, 13]
         },
         size: 12
      })],
      verticalOffset: {
         screenLength: 150,
         maxWorldLength: 2000,
         minWorldLength: 30
        }
    })
});
graphicsFeatureLayer.labelsVisible = true;
graphicsFeatureLayer.labelingInfo = [featureLayerLabels];

Am I missing something here? Is anyone else having this issue? Any help or feedback is much appreciated. Thanks

0 Kudos
1 Solution

Accepted Solutions
AndrewLindley
New Contributor III

I resolved this problem by creating another feature layer from the centroid of the polygons I already had, and tying the labels to that points feature layer instead. The flickering/ disappearing problem is gone and I got the vertical offset property to work with callouts, but as far as I can tell, you do need callouts in order to use the vertical offset property. I'm not 100% sure about that, but my vertical offset only took effect once I had a working callout. 

View solution in original post

0 Kudos
7 Replies
AndrewLindley
New Contributor III

I resolved this problem by creating another feature layer from the centroid of the polygons I already had, and tying the labels to that points feature layer instead. The flickering/ disappearing problem is gone and I got the vertical offset property to work with callouts, but as far as I can tell, you do need callouts in order to use the vertical offset property. I'm not 100% sure about that, but my vertical offset only took effect once I had a working callout. 

0 Kudos
ThomasSolow
Occasional Contributor III

I've noticed this.  It seems to have to do with the order that the elevation and the labels are drawn.  As you zoom in and out, the elevation updates and the terrain will shift.  The labels appear not to be shifting with the terrain.

0 Kudos
RalucaNicola1
Esri Contributor

The callouts and vertical offsets with labels on polygons or polylines seem to be a bug on our side. I've tracked it and we are working on a fix.

Your workaround does the trick, thanks for trying out and reporting this!

But I can't repro the flickering and disappearing effect. Have a look at this snippet and let me know what is different in your case: labels on polygons snippet.

0 Kudos
ThomasSolow
Occasional Contributor III

Here's a sample to demonstrate the problem I've seen with labels and elevation layers: JS Bin - Collaborative JavaScript Debugging

The labels are usually are drawn very high up, way above the ground, so you may have to zoom out after the view zooms to the layer's extent.  My feeling is that the labels are drawn once, when the view and layer loads, and then not updated as the elevation updates as the camera moves around.

(login: viewer1234/password1234)

0 Kudos
AndrewLindley
New Contributor III

This is interesting. It's different from the behavior I was seeing but I agree that they could be related. In my experience, the labels were drawing right on the ground, and not allowing any sort of vertical offset. I tried adding the vertical offset and callout properties from RNicola-esristaff‌'s snippet into yours, and the feature layer doesn't fully draw and the labels won't appear at all.

0 Kudos
AndrewLindley
New Contributor III

I was able to reproduce the behavior from your snippet by tilting the camera angle down so that the view is more oblique and the sky takes up about half of the view. Then I zoomed in on the 'Colorado' label and after a certain point it flickers a little and then disappears for all larger scales. I was able to reproduce it on the 'Wyoming' and 'Montana' labels too, but the 'Utah' label seems to be fine no matter what scale you zoom to, just like my original problem where the flickering/disappearing only happened on some polygons. 

0 Kudos
RalucaNicola1
Esri Contributor

I can reproduce now with our data. Indeed that is the problem, when the polygons are draped, we don't update the labels as the elevation updates. I've tracked it, thanks a lot for the help!

0 Kudos