Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
Alternatively, what would I need to do to create this functionality? –  jvangeld Mar 22 '11 at 17:54

3 Answers 3

up vote 5 down vote accepted

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.