Can we draw a line by selecting Point A and PointB on a existing polyline which is not a straghit line using arcgis javascript Api?
To my knowledge, I don't believe there is anything in the API (3 or 4) that is going to do exactly what you want, out of the box.
I believe it would require some custom effort to achieve. Essentially you want to copy a polyline feature between 2 points, from what I understand.
You could do something like the following:
- Capture the start and endpoints from the user
- Intersect them with features from a given layer to find the closest feature
- Make a copy of that feature's geometry
- Edit the geometry to start and finish at the start and end points chosen by the user
- Apply those edits to your copy layer
Thank you Mark.
Hi Mark,
Can we achieve that functionality using 3.x ?
Are you asking if the ArcGIS for JavaScript API has functionality that allows users to draw a line that automatically snaps to an existing polyline by just selecting the 2 endpoints?
If that is your question then I believe that it is not possible (out of the box).
Snapping is not currently implemented for editing under version 4 of the API:
Functionality matrix | ArcGIS API for JavaScript 4.15
Under version 3, the Editor widget supports snapping but you would need to click on each of the polyline's vertexes to overlay your polyline exactly. You can see the Editor widget snapping in action at this line (press Cntrl to enable snap):
ArcGIS API for JavaScript Sandbox
Mark
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.