AnsweredAssumed Answered

geomertyEngine.distance Explanation needed

Question asked by roberttaracha on Aug 14, 2017

Hey, I am trying to set up a sample javascript application, it will give me back distance within a given area. 


Sample Code


provincal_park_lyr.queryFeatures(query).then(function(results){//number to beat is 82
var distance_param = new DistanceParameters();
var pp_point = results['features'][0].geometry;
/*distance_param.distanceUnit = "kilometers";
distance_param.geometry1 = compare_point;
distance_param.geometry2 = pp_point;
distance_param.geodesic = true;*/


console.log("compare_point", compare_point);
console.log("pp_point", pp_point);
var distance = geometryEngine.distance(compare_point, pp_point,'kilometers');


console.log("provincal_park_lyr layer query",results['features']); // prints all the client-side graphics to the console


Now i am comparing a polygon to a given point. 


When I use the distance method it spits outs a huge number,


10,101 km

see link below, I circles the outputs and GEO distance  ---> is the distance variable

The Output results