Inserting points in polyline with specific distance using ArcGIS API for JavaScript

1453
1
01-11-2017 11:50 PM
haniyejfr
New Contributor

In my web application(ArcGIS JavaScript API) users draw a polyline by freehand polyline tool.

How can i create points geometry in this polyline with certain distances?

0 Kudos
1 Reply
FC_Basson
MVP Regular Contributor

I don't think you can do this with a Geometry Service or the API's geometryEngine tools.  You might need to iterate through the points in the polyline path, testing the distance from the start to the path point each time, until you reach the path point just beyond the distance you require.  Then you know the required distance point is between the last path point (n) and the path point just before the required distance (n-1), of which you know both points' distance from the start as well as the distance between path point n and path point n-1. Now you can calculate the coordinate of your required point with basic Pythagoras theorem.

0 Kudos