AnsweredAssumed Answered

JS api geometryEngine distance units

Question asked by lukepatrick on Jul 13, 2015

I'm trying out the geometryEngine api from the JavaScript framework and it doesn't seem to work as intended.

 

Some code to do distance between two points:

 

require(["esri/geometry/geometryEngine"], function(geometryEngine) {

          this.sr = new esri.SpatialReference({

            wkid: 4326 //decimal degrees

        });

this.distanceUnit = 9001;

var distance = new Number(0);

geometry1 = new esri.geometry.Point(-105, 40, this.sr);

        geometry2 = new esri.geometry.Point(-100, 30, this.sr);

 

        distance = geometryEngine.distance(geometry1, geometry2, this.distanceUnit);

 

      });

 

the distance returned seems to be a decimal-degree unit, not ever the units I specify (e.g. 9001:meter, 9036:kilometer, 9035:mile)

Is there something I'm missing?

Outcomes