<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Geometry Service Geodesic Distance/WrapAround180 Problem in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254671#M23622</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;distParams.geometry1 = this.inputPoints[this.inputPoints.length - 2];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distParams.geometry2 = this.inputPoints[this.inputPoints.length - 1];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distParams.geodesic = true;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //draw a polyline to connect the input points
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var polyline = new esri.geometry.Polyline(map.spatialReference);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline.addPath([distParams.geometry1, distParams.geometry2]);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.measureGraphics.add(new esri.Graphic(polyline, polylineSymbol));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Calculate the geodesic distance 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.geometryService.distance(distParams, dojo.hitch(this, this.calculateDistance));&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is, with WrapAround180 set to true for the app, any measurement across the International Date Line returns "null" instead of a mileage.&amp;nbsp; For example, if I measure from LA to China, across the Pacific ocean, I get null.&amp;nbsp; However, if I measure from LA to China going the other direction, I get a value just fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this a bug or is there some workaround I need to allow the Distance task to work properly with WrapAround180?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Dec 2011 18:32:20 GMT</pubDate>
    <dc:creator>MarkHoover</dc:creator>
    <dc:date>2011-12-20T18:32:20Z</dc:date>
    <item>
      <title>Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254671#M23622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;distParams.geometry1 = this.inputPoints[this.inputPoints.length - 2];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distParams.geometry2 = this.inputPoints[this.inputPoints.length - 1];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distParams.geodesic = true;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //draw a polyline to connect the input points
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var polyline = new esri.geometry.Polyline(map.spatialReference);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline.addPath([distParams.geometry1, distParams.geometry2]);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.measureGraphics.add(new esri.Graphic(polyline, polylineSymbol));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Calculate the geodesic distance 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.geometryService.distance(distParams, dojo.hitch(this, this.calculateDistance));&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is, with WrapAround180 set to true for the app, any measurement across the International Date Line returns "null" instead of a mileage.&amp;nbsp; For example, if I measure from LA to China, across the Pacific ocean, I get null.&amp;nbsp; However, if I measure from LA to China going the other direction, I get a value just fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this a bug or is there some workaround I need to allow the Distance task to work properly with WrapAround180?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 18:32:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254671#M23622</guid>
      <dc:creator>MarkHoover</dc:creator>
      <dc:date>2011-12-20T18:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254672#M23623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please check this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/namespace_geometry.htm#geodesicLengths"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/namespace_geometry.htm#geodesicLengths&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 19:58:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254672#M23623</guid>
      <dc:creator>JianHuang</dc:creator>
      <dc:date>2011-12-20T19:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254673#M23624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it a bug of the GeometryService's Distance method that it fails to work across the IDL?&amp;nbsp; Because if that worked, that would be the functionality I need for my app.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:10:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254673#M23624</guid>
      <dc:creator>MarkHoover</dc:creator>
      <dc:date>2011-12-21T18:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254674#M23625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&amp;nbsp; 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.&lt;BR /&gt;&lt;BR /&gt;Is it a bug of the GeometryService's Distance method that it fails to work across the IDL?&amp;nbsp; Because if that worked, that would be the functionality I need for my app.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A bit of a hack, but would it be possible to check geom1 and geom2, and if east to west, switch them so measurement is always west to east?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:23:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254674#M23625</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2011-12-21T18:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254675#M23626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That's not ideal.&amp;nbsp; The user should be able to specify whether they want to measure east-to-west or west-to-east.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:31:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254675#M23626</guid>
      <dc:creator>MarkHoover</dc:creator>
      <dc:date>2011-12-21T18:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254676#M23627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;That's not ideal.&amp;nbsp; The user should be able to specify whether they want to measure east-to-west or west-to-east.&amp;nbsp; 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.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Very much agreed.&amp;nbsp; I was not suggesting you tell the user to measure west to east, but for you as a developer to check the points prior to submitting them to the calculation and swap them behind the scenes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:34:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254676#M23627</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2011-12-21T18:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254677#M23628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could you please post your code regarding the observation of "the distance from Wyoming to Nevada is 10,000 miles."? We compared the results between from the geometry service and the client algorithm. They are identical. Meanwhile the client method handles the wraparound case with no problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:41:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254677#M23628</guid>
      <dc:creator>JianHuang</dc:creator>
      <dc:date>2011-12-21T18:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254678#M23629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah, I misinterpreted your initial post.&amp;nbsp; 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.&amp;nbsp; Now I see you meant to exchange the values in geom1 and geom2 and call the task normally.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I contend I shouldn't have to do that, though, if the Distance task worked across the IDL.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:43:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254678#M23629</guid>
      <dc:creator>MarkHoover</dc:creator>
      <dc:date>2011-12-21T18:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254679#M23630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jian,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe the 10,000 miles may have been caused by the polyline not being in a geographic coordinate system, as specified by the method you referenced.&amp;nbsp; I will try again and convert the polyline first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still, is this not a bug of the geometryService?&amp;nbsp; Shouldn't it be able to handle wrapAround too?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:46:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254679#M23630</guid>
      <dc:creator>MarkHoover</dc:creator>
      <dc:date>2011-12-21T18:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254680#M23631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Ah, I misinterpreted your initial post.&amp;nbsp; 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.&amp;nbsp; Now I see you meant to exchange the values in geom1 and geom2 and call the task normally.&lt;BR /&gt;&lt;BR /&gt;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).&lt;BR /&gt;&lt;BR /&gt;I contend I shouldn't have to do that, though, if the Distance task worked across the IDL.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Completely agreed that you shouldn't have to.&amp;nbsp; I write alot of code I shouldn't have to as well (primarily if(dojo.isIE){})&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254680#M23631</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2011-12-21T18:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Service Geodesic Distance/WrapAround180 Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254681#M23632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Completely agreed that you shouldn't have to.&amp;nbsp; I write alot of code I shouldn't have to as well (primarily if(dojo.isIE){})&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Haha, well yes, I know.&amp;nbsp; But I figured that, if this is a bug, Esri should at least have it in their database, if they don't.&amp;nbsp; I'm fine to use the workaround Jian provided, which, once I got the spatialReference right on, works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:55:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geometry-service-geodesic-distance-wraparound180/m-p/254681#M23632</guid>
      <dc:creator>MarkHoover</dc:creator>
      <dc:date>2011-12-21T18:55:20Z</dc:date>
    </item>
  </channel>
</rss>

