<?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 What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170105#M8362</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using Arcade Code, I've obtained the coordinates between two points and used Vincenty's Formula to calculate the distance between the two points; however, it's not as accurate as the measure tool in the Web Map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering what the correct formula I should use for calculating the distance between two points using their coordinates.(I know it depends on the coordinate system, but I thought WGS 1984 would be Vincenty's Formula.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also don't want the Planar Distance... so no Distance(Feature1,Feature2) please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH&gt;Vincenty's&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;function Vincenty(lat1,lon1,lat2,lon2){&lt;BR /&gt; var x = PI / 180;&lt;BR /&gt; var latone = lat1 * x;&lt;BR /&gt; var lonone = lon1 * x;&lt;BR /&gt; var lattwo = lat2 * x;&lt;BR /&gt; var lontwo = lon2 * x;&lt;BR /&gt; var deistance = 2 * asin(sqrt(pow(sin((lat1-lat2)/2),2) + cos(lat1) * cos(lat2) * pow(sin((lon1 - lon2) / 2), 2)));&lt;BR /&gt; return deistance * 6378137;&lt;BR /&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH&gt;How I Get the Coordinates&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;var xthis = Round(Geometry($feature).X,2);&lt;BR /&gt;var ythis = Round(Geometry&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Apr 2019 15:25:32 GMT</pubDate>
    <dc:creator>deleted-user-TRj-mR_qEmwV</dc:creator>
    <dc:date>2019-04-08T15:25:32Z</dc:date>
    <item>
      <title>What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170105#M8362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using Arcade Code, I've obtained the coordinates between two points and used Vincenty's Formula to calculate the distance between the two points; however, it's not as accurate as the measure tool in the Web Map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering what the correct formula I should use for calculating the distance between two points using their coordinates.(I know it depends on the coordinate system, but I thought WGS 1984 would be Vincenty's Formula.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also don't want the Planar Distance... so no Distance(Feature1,Feature2) please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH&gt;Vincenty's&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;function Vincenty(lat1,lon1,lat2,lon2){&lt;BR /&gt; var x = PI / 180;&lt;BR /&gt; var latone = lat1 * x;&lt;BR /&gt; var lonone = lon1 * x;&lt;BR /&gt; var lattwo = lat2 * x;&lt;BR /&gt; var lontwo = lon2 * x;&lt;BR /&gt; var deistance = 2 * asin(sqrt(pow(sin((lat1-lat2)/2),2) + cos(lat1) * cos(lat2) * pow(sin((lon1 - lon2) / 2), 2)));&lt;BR /&gt; return deistance * 6378137;&lt;BR /&gt;}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef;"&gt;&lt;TH&gt;How I Get the Coordinates&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;var xthis = Round(Geometry($feature).X,2);&lt;BR /&gt;var ythis = Round(Geometry&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2019 15:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170105#M8362</guid>
      <dc:creator>deleted-user-TRj-mR_qEmwV</dc:creator>
      <dc:date>2019-04-08T15:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170106#M8363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Normally when you extract the coordinates in ArcGIS Online,they will be returned as&amp;nbsp;Web Mercator Auxiliary Sphere. To get WGS 1984 coordinates you could convert them, however this conversion might not be precise enough for you:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;MetersToLatLon&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// Converts XY point from Spherical Mercator EPSG:900913 to lat/lon in WGS84 Datum&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// Fuente: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; originShift &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; PI &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;6378137.0&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lon &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; originShift&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lat &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;y &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; originShift&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

    lat &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180.0&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; PI &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Atan&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Exp&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; lat &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; PI &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; PI &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;lat&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How big is the difference between the distance calculated in Arcade and provided in the Web Map. At what scale did you get these results?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170106#M8363</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T08:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170107#M8364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Xander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a result where it's zoomed in all the way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Measured Distance&amp;nbsp; = 4.04 Meters&lt;BR /&gt;&lt;IMG alt="" class="image-1 jive-image" height="372" src="https://community.esri.com/legacyfs/online/441555_measured_distance.PNG" width="416" /&gt;&lt;/P&gt;&lt;P&gt;Arcade Code Vincenty Formula (Also just used the MetersToLatLon): 166.62 Meters&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/441556_arcade_distanec.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2019 13:44:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170107#M8364</guid>
      <dc:creator>deleted-user-TRj-mR_qEmwV</dc:creator>
      <dc:date>2019-04-09T13:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170108#M8365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is a huge difference! I just noticed in your code that you round the coordinates&amp;nbsp;with two decimals. I assume that those coordinates are not decimal degrees, since that would cause large errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do you get the "other" geometry? Do you use a FeatureSetBy function for this or do you define the point geometry using json in the expression? What coordinates does each point have?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2019 14:52:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170108#M8365</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2019-04-09T14:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170109#M8366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get the other geometry by using FeatureSetBy,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The Away is the other geometry coordinates:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/441594_LATHERELATAWAY.PNG" /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Do you need my workflow?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2019 18:59:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170109#M8366</guid>
      <dc:creator>deleted-user-TRj-mR_qEmwV</dc:creator>
      <dc:date>2019-04-09T18:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170110#M8367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would be nice to know what your workflow is, but I just did a little test:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Function &lt;SPAN class="token function"&gt;Vincenty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lat2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; x &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; PI &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; latone &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lat1 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lonone &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lon1 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lattwo &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lat2 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lontwo &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lon2 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Asin&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Sqrt&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Pow&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Sin&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat1&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;lat2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Cos&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Cos&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Pow&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Sin&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lon1 &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; lon2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; dist &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;6378137.0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lat1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;42.953736914823466&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lon1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;80.05933367671577&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lat2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;42.953744767302474&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; lon2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;80.0592853969535&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; dist &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Vincenty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lat2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dist&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// return dist;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 166.6173571575417&lt;/SPAN&gt;

Function &lt;SPAN class="token function"&gt;LatLonToMeters&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// convert from long/lat to google mercator (or EPSG:4326 to EPSG:900913)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// Source: https://gist.github.com/springmeyer/871897&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; x &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lon &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;20037508.34&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; y &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Tan&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;90&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; lat&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; PI &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;PI &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    y &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; y &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;20037508.34&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;180&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// var pnt1 = Point({'x' : lon1, 'y' : lat1, 'spatialReference' : {'wkid' : 3857}});&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// var pnt2 = Point({'x' : lon2, 'y' : lat2, 'spatialReference' : {'wkid' : 3857}});&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; xy1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;LatLonToMeters&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; xy2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;LatLonToMeters&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lat2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lon2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; pnt1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'x'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; xy1&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'y'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; xy1&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'spatialReference'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'wkid'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3857&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; pnt2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'x'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; xy2&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'y'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; xy2&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'spatialReference'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'wkid'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3857&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; dist2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Distance&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pnt1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; pnt2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"meters"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;dist2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//5.5055826563587&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; dist2&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the first part does the vicenty calculation and the result is: 166.6173571575417&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second part, converts the lat lon coordinates to web mercator and uses the distance and yields 5.05558265633587 m, which is closer to the 4.04 m in the web map.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:49:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170110#M8367</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T08:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170111#M8368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm guessing the Vincenty code might be wrong or it is not proper for the coordinate system then.&lt;BR /&gt;&lt;BR /&gt;The Distance(pnt1,pnt2,"meters") gives the planar distance, so doesn't account for earth's curvature.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2019 15:17:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170111#M8368</guid>
      <dc:creator>deleted-user-TRj-mR_qEmwV</dc:creator>
      <dc:date>2019-04-11T15:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Proper Equation/Code to Get Distances Via Coordinates in Arcade Code</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170112#M8369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;However, if the distance between the two points is 4 - 5 meters, there is not much curvature you have to account for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2019 16:30:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/what-s-the-proper-equation-code-to-get-distances/m-p/170112#M8369</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2019-04-11T16:30:07Z</dc:date>
    </item>
  </channel>
</rss>

