Hi everybody,I´m developing an app. I draw a line in a map and I have an array with distances in meters. I need transform these distances into the polyline in points, and I don´t know do it.I prepared next two functions. I use line and position as parameters in LRSLocatePoint. Line is my poliline and position is the distance value, but is not working.function LRSLocatePoint(line, position) {
require([
"esri/geometry/Point"
],
function (Point) {
var curPos = 0;
var point = false;
var myspatialReference = line.spatialReference;
var arraylinepaths = line.paths[0];
for (var i = 0; i < arraylinepaths.length; i++) {
lastPos = curPos;
var position1 = new Point(arraylinepaths, myspatialReference);
var position2 = new Point(arraylinepaths[i + 1], myspatialReference);
curPos = curPos + esri.geometry.getLength(position1, position2);
if (curPos > position) {
var posicionRelativa = (position - lastPos) / (curPos - lastPos);
point = LRSLocatePointOnSegment(
arraylinepaths,
arraylinepaths[i + 1],
posicionRelativa
);
break;
}
}
return point;
});
}
function LRSLocatePointOnSegment(point1, point2, position) {
var point = false;
if (position >= 0 && position <= 1) {
x1 = point1.x;
y1 = point1.y;
x2 = point2.x;
y2 = point2.y;
x = x1 + (x2 - x1) * position;
y = y1 + (y2 - y1) * position;
var spatialReference = map.spatialReference;
point = new esri.geometry.Point(x, y, spatialReference);
console.log(point);
}
return point;
}
Help!!!!:confused: , thank you:D