I want to reproduce the exact same visual effect of highlighting a feature layer, but without using highlight. I have a map that I need to visually break out into different regions (each region multiple features / states), and I want each region to have its geographies grouped together by a surrounding border, pretty much the way highlight does (image attached).
I have tried merging the geometries together using union and creating a graphic, but the union turned out pretty messy with slivers and gaps where some of the geographies merge. I've looked at a ton of different ways to do this, but nothing works even remotely as well as highlight does. I believe i can only have one highlight per layer (that I know of), so I am looking for an alternative.
Does anyone have any advice on how to best do this?
Edit: I realize this question was more vague than I intended, so here's some more specifics:
I am working on the javascript API.
I have a custom webmap where one of the feature layers in it is "World Administrative Divisions"
const myMap = new WebMap ({
portalItem: {id: "xyz"}
})
What I want is to visually group different states in North America into "regions". I can do it individually through highlight, as in the picture. But I would like to create multiple groups, and there is only one highlight per layer. So ideally I would want to do something like:
myMap.when((thisMap)=> {
const stateLayer = thisMap.allLayers.find((layer)=> {
layer.title === "World Administrative Divisions"
})
myView.whenLayerView(stateLayer).then((thisView) => {
thisView.highlight([1178,3736,5135,1107]) // state group 1
thisView.highlight([3518,5213,2359,3803]) // state group 2
})
} This obviously doesn't work, as it just adds the second group into the same highlight.
I've tried using a graphic layer to add different colored graphics for each group, but
1) it feels like overkill, to reproduce all the geometries that already exist in my feature layer
2) each feature / graphic has it's own border so you don't get the same visual impact of a single block (image of graphic approach attached as well)
Any guidance or alternatives would be greatly appreciated