WAB Measure widget - show segment lengths

Jump to solution
02-05-2015 11:22 AM
Occasional Contributor III

I am wondering if there is a way to have the line segment length show up dynamically in the widget and on the map when using the measure widget for Web Appbuilder. I have some users who want to have the text on the map be dynamic as they draw and then once they click on the map to put a vertex down then the line segment text will show up on the map. Also a total length is needed.

Tim Witt‌ made a javascript example here:

geonet: https://community.esri.com/people/timw1984/blog/2014/07/22/javascript-api-advanced-draw-widget#comme... 

jsfiddle: http://jsfiddle.net/timw1984/4p7d241v/17/embedded/result/

This shows the line segment value but still does not add  the text to the map.

0 Kudos
1 Solution

Accepted Solutions
Occasional Contributor III
0 Kudos
3 Replies
MVP Alum

Hey Stan,

You are right, I went with only showing the total length of the line, but you could rewrite the code to show you the length of each segment.

The way I would do it is whenever the user clicks on the map it uses those coordinates to produce a point which will be used to place the lable for the length of the line segment, which will be placed once the user clicks again.

click -> get lable point -> click again -> place measurement -> save new label point ->... -> double click place total measurement + pleace measurement of last measurement.

I hope this somewhat explains my thought process.

Maybe in the future release I will add this to my draw tool.


0 Kudos
Occasional Contributor III

It looks like Tom Sellsted‌ has the solution I am looking for here Measure Widget for Web App Builder Version

0 Kudos
MVP Regular Contributor


Excellent!  I had created a similar widget for the FlexViewer and had meant to create something similar for WAB, but had some other projects in my way until now.  I hope this works well for you.

Best Regards,