distParams.geometry1 = this.inputPoints[this.inputPoints.length - 2]; distParams.geometry2 = this.inputPoints[this.inputPoints.length - 1]; distParams.geodesic = true; //draw a polyline to connect the input points var polyline = new esri.geometry.Polyline(map.spatialReference); polyline.addPath([distParams.geometry1, distParams.geometry2]); this.measureGraphics.add(new esri.Graphic(polyline, polylineSymbol)); //Calculate the geodesic distance this.geometryService.distance(distParams, dojo.hitch(this, this.calculateDistance));
I don't think that's what I want...for example, using the method you prescribed, the distance from Wyoming to Nevada is 10,000 miles.
Basically I want the user to be able to click on the map, then click a second point, anywhere in the world, and have it return a distance. The distance method of the Geometry Service does that quite nicely for our needs, especially with the distanceParam.geodesic set to true, except whenever a measurement spans the IDL (even if it's a very small measurement), I get "null miles" back.
Is it a bug of the GeometryService's Distance method that it fails to work across the IDL? Because if that worked, that would be the functionality I need for my app.
That's not ideal. The user should be able to specify whether they want to measure east-to-west or west-to-east. If a user wants to know the distance from NY to LA, they should get the same result whether they pick NY or LA as their starting point.
Ah, I misinterpreted your initial post. I was thinking you were suggesting that if they put NY in first, then LA, that we measure west-to-east starting from NY and going the long way around the globe. Now I see you meant to exchange the values in geom1 and geom2 and call the task normally.
That might be possible using the alternate method, if I could figure out how to determine which point is "west" of the other (especially if you're measuring more than halfway around the globe).
I contend I shouldn't have to do that, though, if the Distance task worked across the IDL.