Priorities for labelclass?

394
7
04-22-2020 10:09 PM
EricRydgren
New Contributor II

Hi,

I am trying to prioritize my labelclasses by a custom variable. The documentation says "Defines label priorities", which should meen that you are able to prioritize the labels somehow. I cant find any property that will help me do that?

Any suggestion on how to solve my problem?

I am using ArcGis 4.11.

Thank you in advance! 

0 Kudos
7 Replies
Noah-Sager
Esri Regular Contributor

Currently, label priorities can be established using a where expression:

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#wh...

This allows you to only label features that evaluate to `true`. You can also create multiple label classes with different where expressions:

Sample Code | ArcGIS API for JavaScript 4.15 

Down the road we are considering different methods to establish label priorities. Also, please consider upgrading to the latest version of the JS API, which is 4.15.

Hope this helps!

EricRydgren
New Contributor II

Thank you for your response!

Unfortunatly I think you have missunderstood the question, or maybe I was not asking it clearly enough.

What i meen is that i want to prioritize the drawing order of the labels, which means if 2 features are placed close to eachother in the map, I want to specify which of them that will be visible for the user. 

Is there any way to make such prioriting for labelclasses?

Thank you!

0 Kudos
mgeorge
Esri Contributor

Hi Eric Rydgren‌,

Yes I don't think we yet have a great way of doing what you are asking for, however I have heard a request for something similar from other users in the past. Can you give us a few more details?

- Would supporting a LabelClass.priority property be enough to fit your use case?

- Do you only want to pin a specific feature's label?

- Do you want the priority to differ between features of a given labelClass? (make it attribute-driven)

Matt

EricRydgren
New Contributor II

Hi!

- Would supporting a LabelClass.priority property be enough to fit your use case?

Yes, i think that will do the trick. Preferebly as an integer, to get infinit number of priority-levels.

- Do you only want to pin a specific feature's label?

No, no need to prioritize specific features label. 

- Do you want the priority to differ between features of a given labelClass? (make it attribute-driven)

No, for a given labelclass I only need the priority property, in my case.

 Is this something you will consider implement soon?

Best regards, Eric

mgeorge
Esri Contributor

Thanks Eric. We don't have a time frame for this yet, but I would probably guess in 2-3 releases. Will likely depend on how much feedback we get concerning this.

Matt

0 Kudos
EricRydgren
New Contributor II

Thank you for a quick respond about this. For us this is quite essential, and we are looking forward for this to work in the future. 

Can you please tell me what is making the priority for labels at this point? Is it placement in the map, or maybe it is which feature that has been loaded first?

I would really appriciate if you could look into this, and maybe we can use that information to tweek our app in the meenwhile. 

Thank you

Eric

0 Kudos
mgeorge
Esri Contributor

Hi Eric,

There is no per-labelClass priority at the moment. Likely whatever comes first would drive the priority, and that depends loosely on how the data is loaded, spatially indexed, and patched to the individual tiles. There is per-layer priority, with labels from top labels take precedence over those in the lower lays.

Matt

0 Kudos