6

I would like to know if the ArcGIS Javascript API has built in snapping functionality for the measure tool. I am trying to create a measure tool which only measures distances along the edge of roads. Is there anything built-in or would I need to create this functionality by linking into ArcObjects?

asked Mar 21, 2011 at 20:40
1
  • Alternatively, what would I need to do to create this functionality? Commented Mar 22, 2011 at 17:54

3 Answers 3

5

Not sure it did when the question was first asked but it sure does now.

Check the sample:

http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/widget_measurement

answered Feb 28, 2013 at 13:18
2

I think you'll need to write your own custom tool. I don't see a method in the REST API that returns a point and feature ID that is closest to a specified point. You could use a query request, but then you'd have to use javascript to loop through the returned features to find the closest point on the closest feature relative to the point where the user clicked. Personally, I think it would be easier to write a REST based SOE, but only because my C# is better than my javascript.

answered Mar 22, 2011 at 19:53
2

Based on my observation of how the Silverlight SDK works (which has snapping), I believe you will have to write your own snapping implementation. I don't think there's anything on the server that will really help you.

You will have to retrieve the geometries associated with the road(s) you want to measure via the FeatureServer. Then on the measure tool, you'll have to enable a mouse listener to search the vertexes of the visible geometries.

answered Mar 23, 2011 at 14:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.