bb1769

geodesicLengths returns NaN

Discussion created by bb1769 on Sep 6, 2012
Latest reply on Jan 24, 2013 by Jian
I'm getting an invalid value (NaN) back from the esri.geometry.geodesicLengths function for certain lines. This only happens occasionally, and I haven't detected a pattern as to what about the path is triggering the error. Here's an example that displays the problem. I tried this with the 3.1 API.

function init() {
  var line = new esri.geometry.Polyline({"paths":[[[-113.3388907526918,53.6252478988518],[-113.27571936597303,53.57961406863708],[-113.27571936597303,53.57961406863708],[-113.27571936597303,53.566566774741844],[-113.28121253003553,53.53964401478653],[-113.30318518628555,53.519236579065456],[-113.32241126050428,53.50943751677841],[-113.34438391675431,53.50943751677841],[-113.36772986401994,53.51025419185318],[-113.3869559382387,53.51678702593175],[-113.41167517651995,53.53882790615631],[-113.41030188550432,53.560041617991864],[-113.40068884839496,53.58613620592375],[-113.35262366284805,53.62036091795674],[-113.3388907526918,53.6252478988518]]],"spatialReference":{"wkid":4326}});
 
  var lengths = esri.geometry.geodesicLengths([line], esri.Units.METERS);
  document.write("Measured length is: " + lengths[0]);
 }
 
 dojo.addOnLoad(init);


The above line is derived from a polygon so closes on itself, but other I've had this with other polylines that do not close on themselves.

Outcomes