Select to view content in your preferred language

Toggle NearMe Proximity Circle On and Off

158
2
3 weeks ago
Labels (1)
GregReinecke
Occasional Contributor

Hello,

I have been using the NearMe widget and it works great.  Once the distance is set and the zone produced I'd like to be able to simply toggle the shaded circle on and off.  Is there a way? I thought perhaps a custom toggle button but I don't what layer or id or whatever the proximity circle feature is stored as.  Perhaps someone has an innovative idea.

.ProxZone.png

Thanks.

GRMapper

0 Kudos
2 Replies
JeffreyThompson2
MVP Regular Contributor

There isn't a built-in way for the user to toggle the search area. Nor is there a way for the designer to completely turn-off the circle. The closest option I have found is to set your Sketch Color to transparent white. You'll need to go to custom colors and set it to 255,255,255,0.

JeffreyThompson2_0-1719951231054.png

Going into custom development options, you should be able to find the id of the graphic by console logging allLayerViews. I am pretty sure that it will be project specific, if not completely random.

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#allLayerViews

This reactiveUtils example will probably be useful.

// Watching for changes within a Collection
reactiveUtils.watch(
 () => view.map.allLayers.length,
 () => {
   console.log(`Layer collection length changed: ${view.map.allLayers.length}`);
 });

https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#watch

GIS Developer
City of Arlington, Texas
0 Kudos
GregReinecke
Occasional Contributor

Jeffrey,

Thank you for the reply. Tweaking the sketch color doesn't really work for me in this requirement and I'll need to really understand the coding the opportunities you linked.  I though perhaps using the Swipe widget must provide an option so I'll continue to investigate that as well.  Thanks again,

Greg

0 Kudos