Label a Multipoint Layer in ArcGIS JavaScript API

943
5
02-17-2021 10:36 AM
RyanSutcliffe
Occasional Contributor II

I would like to label features from a Multipoint FeatureLayer in ArcGIS JavaScript API 4x. Is this possible? I can't get it to work. 

Here is what I've tried:

let url = [my multipoint service layer url]

  var layer = new FeatureLayer({
    url: url,
    opacity: 0.9,
    renderer: {
      type: "simple", //autocasts
      symbol: {
        type: "simple-marker", //autocasts
        size: 3,
        color: "white",
      },
    },
    title: "Site Labels",
    labelingInfo : {
      labelExpressionInfo: {expression: "$feature.[myfield]"},
      symbol: {
        type: "text",
        color: "black",
        haloSize: 1,
        haloColor: "white"
      }
    },
  });

  
  var map = new Map({
    basemap: "topo",
    layers: [layer]
  });
Basically, the same way you would label a simple point layer. For a point layer this will work. No labels appear for a multipoint layer. Can't find anything online besides the statement:
Currently a feature can only have one label. If a feature satisfies the where condition of multiple LabelClasses, then only the label corresponding to the first matching LabelClass is displayed.
Which might mean that with multipoint point layers we're out of luck? 
Tags (1)
0 Kudos
5 Replies
RyanSutcliffe
Occasional Contributor II

ESRI Canada got back to me. They've logged a bug (BUG-000137586 Labels for Multipoints Fail to Render in Javascript API 4.18) for this. Just in case anyone else comes across same issue.

Noah-Sager
Esri Regular Contributor

Thanks for getting this issue logged. We currently do not support Multipoint geometries by design, but this issue will help drive the enhancement request.

0 Kudos
Annina_Hirschi_Wyss
Occasional Contributor

Any idea when this will be fixed? As this also affects the new Map Viewer in AGOL, my layer doesn't get labelled... Thx!

0 Kudos
RyanSutcliffe
Occasional Contributor II

Is there somewhere that this lack of support for Multipoint in the ArcGIS JavaScript API is stated? If that is indeed the case I think you should clarify in the documentation. There is a Multipoint geometry class and certainly no mention any support limitations for labelling or otherwise there. The closest I've seen is a Technical Article for ArcGIS Online that refers to lack of support for Multipoint in the context of editing. 

 

0 Kudos
Steve_Weaver
New Contributor II

I would have thought this would have been fixed by now (12/3/2021) since we just had a new release of AGOL.   I will also submit a bug from our organization.