AnsweredAssumed Answered

Label Both overlapping Points in the ArcGIS JavaScript API

Question asked by LucasCotner on Oct 10, 2014
Latest reply on Nov 30, 2017 by nalydleetlub1

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!!)

Outcomes