AnsweredAssumed Answered

Calculate distance between two markers.

Question asked by Lucasbrito3 on Oct 7, 2014
Latest reply on Oct 9, 2014 by Rodrigocastro7

We are trying to calculate the distance between two markers plotted in our map. We tried using the Polyline object but that returns a straight line from one marker to the other, not the real distance, or route. Is there a way to do so? We are using the following function...


function sitepins(val) {
                var iconPath  = "M15.834,29.084 15.834,16.166 2.917,16.166 29.083,2.917z";
                var initColor = "#005CE6";
                var ind=0;
                for (var index = 0; index < arr.length; index++){
                    if (arr[index]==val){
                        ind =index;

                Lon = arr[ind+1];
                Lat = arr[ind+2];
                Lon1 = arr[ind+4];
                Lat1 = arr[ind+5];
                //var polylineJson = {"paths":[[[-122.68,45.53], [-122.58,45.55]]]};
                var singlePathPolyline = new Polyline([[-50, 0], [-120, -20], [-130, 0]]);
                //var polyline = new Polyline(polylineJson);
                var lengths = geodesicUtils.geodesicLengths([singlePathPolyline], Units.KILOMETERS);