Select to view content in your preferred language

Geometry Service Geodesic Distance/WrapAround180 Problem

1670
10
12-20-2011 10:32 AM
MarkHoover
Frequent Contributor
We don't use the native Measurement widget and instead we have built our own, which leverages the GeometryService's Distance method, as seen below:

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));


The problem is, with WrapAround180 set to true for the app, any measurement across the International Date Line returns "null" instead of a mileage.  For example, if I measure from LA to China, across the Pacific ocean, I get null.  However, if I measure from LA to China going the other direction, I get a value just fine.

Is this a bug or is there some workaround I need to allow the Distance task to work properly with WrapAround180?
0 Kudos
10 Replies
MarkHoover
Frequent Contributor
Completely agreed that you shouldn't have to.  I write alot of code I shouldn't have to as well (primarily if(dojo.isIE){})


Haha, well yes, I know.  But I figured that, if this is a bug, Esri should at least have it in their database, if they don't.  I'm fine to use the workaround Jian provided, which, once I got the spatialReference right on, works.
0 Kudos