Label Both overlapping Points in the ArcGIS JavaScript API

4843
4
10-10-2014 09:16 AM
LucasCotner
New Contributor II

In the ArcGIS JavaScript API (I'm currently using 3.10), there does not appear to be a way to label both points that share the same location.

 

In my application, each time an event fires, a Definition Query is applied to a FeatureLayer, and a LabelLayer is created off of that subset of points and added to the map. This all works great. The problem arises when two points share the same location: both points are still within the original FeatureLayer, and even though the LabelLayer CREATES both labels (they are both there in the LabelLayer's "_.preparedLabels" array), the first label of the two is Never added to the LabelLayer's 'graphics' array and thus never added to the map.

 

It is also very hard to compare the graphics array to the preparedLabels array as they only appear to be populated while inside a LabelLayer Event function. This makes it tough to find elements missing from the former.

 

This seems like a basic requirement, but I have so far been unable to find any documentation on the issue or forum posts expressing a similar problem. Any suggestions or help would be much appreciated!

 

Thanks!

 

A snidbit of my code is below:

 

this.addressLayer.setDefinitionExpression("...");

 

var symbol = new TextSymbol();

var renderer = new SimpleRenderer(symbol);

var labelLayer = new LabelLayer();

 

labelLayer.addFeatureLayer(this.addressLayer, renderer, "{WalkOrder}");

 

this.map.addLayer(labelLayer);

 

          //labelLayer._preparedLabels.length --> 29

          //labelLayer.graphics.length --> 28 (missing our overlap!!)

4 Replies
by Anonymous User
Not applicable

Is there any resolution for this issue in newer versions of the API? I need both labels to appear for two overlapping polygons, otherwise there appears to be only 1. I'm on v3.14 but would happily upgrade to deal with this

0 Kudos
DylanBulteel
New Contributor II

Was there any solution for this? As need to enable overlapping labels on features on my GIS platform however I can't seem to find a way to do so.

0 Kudos
LauraEmerson1
New Contributor II

Lucas Cotner‌ did you ever find a solution to this? Im looking to fix an overlapping issue on a custom WAB widget. 

0 Kudos
LucasCotner
New Contributor II

Hey Laura, unfortunately I never did! LabelLayer does not exist in the ESRI JS 4.x API, and so we don't use them anymore.

0 Kudos