<?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: @arcgis/core - Find distance between 2 points in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237651#M79547</link>
    <description>&lt;P&gt;You can use the geometry engine for this, no need to go to the service.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#distance" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#distance&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here's a sample where it's dynamically imported and used.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/odoe/nearby-app-vanilla/blob/main/src/app.ts#L50-L71" target="_blank" rel="noopener"&gt;https://github.com/odoe/nearby-app-vanilla/blob/main/src/app.ts#L50-L71&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Dec 2022 00:13:10 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-12-05T00:13:10Z</dc:date>
    <item>
      <title>@arcgis/core - Find distance between 2 points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237587#M79546</link>
      <description>&lt;P&gt;Hi, I am use&amp;nbsp;@arcgis/core package in Angular framework.&lt;/P&gt;&lt;P&gt;I want to calculate distance between 2 points by lat and lng of each point using this package.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess that i need something like described in &lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript-questions/how-to-calculate-distance-between-two-give-points/td-p/556281" target="_self"&gt;this link&lt;/A&gt;. But i don't know how to convert this to the ESM approach.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess that i need to import the packages like below, but i don't know how to continue from there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;&lt;P&gt;Note that i have no need to draw Map. I need just the calculation.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;GeometryService&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@arcgis/core/geometry"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Point&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@arcgis/core/geometry/Point"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;Map&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@arcgis/core/Map"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;SpatialReference&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@arcgis/core/geometry/SpatialReference"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;DistanceParameters&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"@arcgis/core/rest/support/DistanceParameters"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 04 Dec 2022 13:48:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237587#M79546</guid>
      <dc:creator>MosheLevi</dc:creator>
      <dc:date>2022-12-04T13:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: @arcgis/core - Find distance between 2 points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237651#M79547</link>
      <description>&lt;P&gt;You can use the geometry engine for this, no need to go to the service.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#distance" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#distance&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here's a sample where it's dynamically imported and used.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/odoe/nearby-app-vanilla/blob/main/src/app.ts#L50-L71" target="_blank" rel="noopener"&gt;https://github.com/odoe/nearby-app-vanilla/blob/main/src/app.ts#L50-L71&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 00:13:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237651#M79547</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-12-05T00:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: @arcgis/core - Find distance between 2 points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237684#M79551</link>
      <description>&lt;P&gt;First of all, thank you very much for your response!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Actually, I need to calculate a distance of driving or walking (routing).&lt;BR /&gt;From what I understand, the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#distance" target="_self"&gt;distance&lt;/A&gt;&amp;nbsp; function calculates Planar distance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry I didn't explain it in advance properly&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 08:31:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237684#M79551</guid>
      <dc:creator>MosheLevi</dc:creator>
      <dc:date>2022-12-05T08:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: @arcgis/core - Find distance between 2 points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237712#M79554</link>
      <description>&lt;P&gt;After more searching, i find out this&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-RouteInfo.html" target="_self"&gt;page&lt;/A&gt;&amp;nbsp;witch seems to fit what i need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just don't understand what it is the:&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;portalItem&lt;/SPAN&gt;&lt;SPAN&gt;: { &lt;/SPAN&gt;&lt;SPAN class=""&gt;id&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN class=""&gt;"69569b47b1e445b8a42ec12feab41ce9"&lt;/SPAN&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I try to replace this to list of stops (that this what i actually need) like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;st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/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;routeLayer&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;RouteLayer&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;stops&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// portalItem: {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// &amp;nbsp; id: "69569b47b1e445b8a42ec12feab41ce9"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;But then, the '&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;routeLayer&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;routeInfo' is null.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What am i missing?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Dec 2022 11:27:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237712#M79554</guid>
      <dc:creator>MosheLevi</dc:creator>
      <dc:date>2022-12-05T11:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: @arcgis/core - Find distance between 2 points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237808#M79560</link>
      <description>&lt;P&gt;The&amp;nbsp;portalItem id is the item in Portal for ArcGIS that is the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html" target="_self"&gt;routeLayer&lt;/A&gt;, which looks as though you can create it from stops.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// A minimum of two stops is required for routing.
const stops = [
    new Stop({ geometry: { latitude: 32.180763, longitude: 34.929558 } }),
    new Stop({ geometry: { latitude: 31.9339, longitude: 34.8878 } })
];
// Create route layer and assign the stops. Only solved routelayers will be rendered.
const routeLayer = new RouteLayer({
    stops
});&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 05 Dec 2022 15:38:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237808#M79560</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2022-12-05T15:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: @arcgis/core - Find distance between 2 points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237910#M79562</link>
      <description>&lt;P&gt;Once you create the route layer, you need to call the solve method to get your route and features&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html#solve" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html#solve&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Then you can get the routeInfo and it will have a totalDistance value you can use&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-RouteInfo.html#totalDistance" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-RouteInfo.html#totalDistance&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-find-distance-between-2-points/m-p/1237910#M79562</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-12-05T18:41:39Z</dc:date>
    </item>
  </channel>
</rss>

