JS api 3.x Stacked Labels?

680
4
Jump to solution
03-15-2021 10:03 AM
JamesCrandall
MVP Frequent Contributor

Anyone have success implementing a stacked label solution in JS api 3.x?  I'm not so sure the "suggested" duplicating layers approach will suffice.

 

We currently have a dev WAB app & custom widget created with WAB Developer 2.19 and looking for solutions.  I REALLY hoped to just do all of this in Arcade at the webmap/weblayer themselves rather than fuss around with a bunch of Javascript in the widget we're building, but the current AGO map viewer still doesn't support stacked labels.  I *can* get the Arcade expression to stack them in the "TEST" output, but doesn't work in the mapviewer itself.

 

Not sure if this just means I can simply save the webmap as the new "beta" version (which is supposed to allow stacked labels) but unsure what that means for our custom widget developed at JS api 3.x

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

No, it's a new sort of animal in the latest versions of AGS and Portal. It's essentially a Map Image Layer, (which allows for all the nice symbology and labeling options,) but rather than being its own registered service referencing an enterprise geodatabase layer, it uses a hosted feature layer as its data source.

As far as I know, they're not available in AGOL, only in Portal. But they're great!

If you're using older AGS services, I think stacked labels are going to be out of reach. But you could always try to migrate the widget over to Experience Builder, too, which is kind of the 4.x WAB.

- Josh Carlson
Kendall County GIS

View solution in original post

4 Replies
jcarlson
MVP Esteemed Contributor

A 3.x map simply doesn't have stacked label abilities, unfortunately. Even if it were properly configured in the beta viewer, any 3.x map/app that renders the labels will discard the line break.

Are hosted map images an option for you?

- Josh Carlson
Kendall County GIS
JamesCrandall
MVP Frequent Contributor

Thank you for the input!

Actually all of the "layers" in the webmap that the WAB/Widget uses as the source are hosted items (I think).  Here's how they are created:

1. Click "Add" -- "Add From Web".

2. Paste in the service url including the layer index number.  These are published to an ArcGIS Server 10.4.1 site.

3. Configure symbology, popups and labels.

4. Save each weblayer to AGO.

5. Save the webmap.

 

Does that constitute as a hosted map image layer?

0 Kudos
jcarlson
MVP Esteemed Contributor

No, it's a new sort of animal in the latest versions of AGS and Portal. It's essentially a Map Image Layer, (which allows for all the nice symbology and labeling options,) but rather than being its own registered service referencing an enterprise geodatabase layer, it uses a hosted feature layer as its data source.

As far as I know, they're not available in AGOL, only in Portal. But they're great!

If you're using older AGS services, I think stacked labels are going to be out of reach. But you could always try to migrate the widget over to Experience Builder, too, which is kind of the 4.x WAB.

- Josh Carlson
Kendall County GIS
JamesCrandall
MVP Frequent Contributor

Thanks for the info Josh!

0 Kudos