<?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 Re: Help! How can I measure the distance between points in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694151#M64545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If all you care about is the distance, then you can get the coordinates of the points for which you need to measure distances; and pass them to the geometry service's "lengths" operation.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Aug 2010 23:02:27 GMT</pubDate>
    <dc:creator>RahulRavikumar</dc:creator>
    <dc:date>2010-08-20T23:02:27Z</dc:date>
    <item>
      <title>Help! How can I measure the distance between points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694150#M64544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, everyone&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm having this problem, I have 2 layers let's say I have this situation: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Layer A:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point4 &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Layer B:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point4&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Points of the two layers are related this way: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A.Point1 connected to B.Point1&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A.Point2 connected to B.Point2&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A.Point3 connected to B.Point3&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A.Point4 connected to B.Point4&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I measure their distance between each other using the JavaScript API , If each point is in a different layer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please If you have some code I can use I will thank you so much! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 20:45:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694150#M64544</guid>
      <dc:creator>AlejandroMorales</dc:creator>
      <dc:date>2010-08-20T20:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help! How can I measure the distance between points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694151#M64545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If all you care about is the distance, then you can get the coordinates of the points for which you need to measure distances; and pass them to the geometry service's "lengths" operation.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Aug 2010 23:02:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694151#M64545</guid>
      <dc:creator>RahulRavikumar</dc:creator>
      <dc:date>2010-08-20T23:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help! How can I measure the distance between points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694152#M64546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your response, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I do that? Can you give some code please? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Aug 2010 13:11:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694152#M64546</guid>
      <dc:creator>AlejandroMorales</dc:creator>
      <dc:date>2010-08-23T13:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help! How can I measure the distance between points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694153#M64547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Two samples that might be helpful:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/util_distance.html"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/util_distance.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/util_measureline.html"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/util_measureline.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Aug 2010 17:28:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694153#M64547</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2010-08-23T17:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help! How can I measure the distance between points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694154#M64548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the help guys! I really appreciate but &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;what I'm trying to do is to measure the distance between 2 points that already have X and Y coordinates so &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point A (Layer 1) has all its properties including X and Y &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point B (Layer 2) same as Point B &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is there a procedure, function where I can get the distance between A and B ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Aug 2010 19:52:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694154#M64548</guid>
      <dc:creator>AlejandroMorales</dc:creator>
      <dc:date>2010-08-24T19:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help! How can I measure the distance between points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694155#M64549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alex,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think if you take a close look at the first page swingley pointed out (&lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/util_distance.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/util_distance.html&lt;/A&gt;&lt;SPAN&gt;), you'll see some code that shows how to set up the parameters for a call to the GeometryService's distance task. It shows how to add geometries from an array. In your case, you'd add your two known points:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var distParams = new esri.tasks.DistanceParameters();
distParams.distanceUnit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
distParams.geometry1 = pointA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;lt;--- your Point A geometry
distParams.geometry2 = pointB;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;lt;--- your Point B geometry
distParams.geodesic = true;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The sample code on the page shows how to call GeometryService.distance and work with its results. The section where it says &lt;/SPAN&gt;&lt;STRONG&gt;function(distance){..})&lt;/STRONG&gt;&lt;SPAN&gt; catches the data returned by GeometryService.distance in the parameter &lt;/SPAN&gt;&lt;STRONG&gt;distance&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
geometryService.distance(distParams, function(distance) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do what you want with the result.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:13:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694155#M64549</guid>
      <dc:creator>TimRourke</dc:creator>
      <dc:date>2021-12-12T05:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help! How can I measure the distance between points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694156#M64550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Tim, thank you so much!, I'm trying it right now I just have one question, when I create the points I use this lines (just to try) :&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;p1 = new esri.geometry.Geometry.Point(767045.94,1620609.96,??); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;p2 = new esri.geometry.Geometry.Point(768450.94,7621609.90,??); &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know what to put in the spatial reference parameter because my map has this as a spatial reference: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PROJCS["WGS_1984_UTM_Zone_15N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-93.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Kilometer",1000.0]]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a lot and I don't think i have to put all that into a parameter right? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please can You tell me, what should I do? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Alex,&lt;BR /&gt;&lt;BR /&gt;I think if you take a close look at the first page swingley pointed out (&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/util_distance.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/util_distance.html&lt;/A&gt;), you'll see some code that shows how to set up the parameters for a call to the GeometryService's distance task. It shows how to add geometries from an array. In your case, you'd add your two known points:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var distParams = new esri.tasks.DistanceParameters();
distParams.distanceUnit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
distParams.geometry1 = pointA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;lt;--- your Point A geometry
distParams.geometry2 = pointB;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;lt;--- your Point B geometry
distParams.geodesic = true;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The sample code on the page shows how to call GeometryService.distance and work with its results. The section where it says &lt;STRONG&gt;function(distance){..})&lt;/STRONG&gt; catches the data returned by GeometryService.distance in the parameter &lt;STRONG&gt;distance&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
geometryService.distance(distParams, function(distance) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do what you want with the result.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Hope that helps,&lt;BR /&gt;&lt;BR /&gt;Tim&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:13:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-how-can-i-measure-the-distance-between-points/m-p/694156#M64550</guid>
      <dc:creator>AlejandroMorales</dc:creator>
      <dc:date>2021-12-12T05:13:08Z</dc:date>
    </item>
  </channel>
</rss>

