<?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: I want to find a distance between 2 coordinates , using 4.16 JavaScript api in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023422#M71633</link>
    <description>&lt;P&gt;It helps to have a very simple CodePen showing just the code related to the issue so we can experience the problem and make suggestions.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 15:21:48 GMT</pubDate>
    <dc:creator>JohnGrayson</dc:creator>
    <dc:date>2021-02-04T15:21:48Z</dc:date>
    <item>
      <title>I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023393#M71629</link>
      <description>&lt;P&gt;Please find below code, i want to find distance between 2 coordinates in feet. How can i achieve this in javascript 4.16.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@{&lt;BR /&gt;Layout = null;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html lang="en"&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;meta charset="utf-8" /&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Map&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;script src="~/lib/jquery/dist/jquery-3.5.1.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/4.16/esri/themes/light/main.css" target="_blank"&gt;https://js.arcgis.com/4.16/esri/themes/light/main.css&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;script src="&lt;A href="https://community.esri.com/" target="_blank"&gt;https://js.arcgis.com/4.16/"&amp;gt;&amp;lt;/script&lt;/A&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /&amp;gt;&lt;BR /&gt;&amp;lt;link rel="stylesheet" href="~/css/site.css" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;html, body, #viewDiv {&lt;BR /&gt;padding: 0;&lt;BR /&gt;margin: 0;&lt;BR /&gt;height: 100%;&lt;BR /&gt;width: 100%;&lt;BR /&gt;}&lt;BR /&gt;.esri-view-width-medium .esri-popup__main-container {&lt;BR /&gt;width: 100%;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;var startingLong;&lt;BR /&gt;var startingLat;&lt;BR /&gt;var vars = {};&lt;BR /&gt;var parts = window.parent.location.href.replace(/[?&amp;amp;]+([^=&amp;amp;]+)=([^&amp;amp;]*)/gi, function (m, key, value) {&lt;BR /&gt;vars[key] = value;&lt;BR /&gt;});&lt;BR /&gt;var livePartitionKey = vars.rowKey;&lt;BR /&gt;var isInitialized = false;&lt;BR /&gt;var map;&lt;BR /&gt;var graphicsLayer;&lt;BR /&gt;require([&lt;BR /&gt;"esri/Map",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/widgets/Locate",&lt;BR /&gt;"esri/widgets/Track",&lt;BR /&gt;"esri/Graphic",&lt;BR /&gt;"esri/layers/GraphicsLayer",&lt;BR /&gt;"esri/tasks/Locator",&lt;BR /&gt;"esri/geometry/support/webMercatorUtils",&lt;BR /&gt;"esri/PopupTemplate",&lt;BR /&gt;"dojo/number", "dojo/parser",&lt;BR /&gt;"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!", "esri/widgets/Popup"&lt;BR /&gt;], function (Map, MapView, Locate, Track, Graphic, GraphicsLayer, Locator, webMercatorUtils,&lt;BR /&gt;PopupTemplate,&lt;BR /&gt;number, parser, Popup) {&lt;/P&gt;&lt;P&gt;parser.parse();&lt;BR /&gt;var locator = new Locator("&lt;A href="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer" target="_blank"&gt;https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer&lt;/A&gt;");&lt;/P&gt;&lt;P&gt;var infoTemplate = new PopupTemplate({&lt;BR /&gt;title: "Location",&lt;BR /&gt;content: "Address: {Address}"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;map = new Map({&lt;BR /&gt;basemap: "streets-navigation-vector"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var simpleLineSymbol = {&lt;BR /&gt;type: "simple-line",&lt;BR /&gt;color: [226, 119, 40], // orange&lt;BR /&gt;width: 2&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var simpleMarkerSymbol = {&lt;BR /&gt;type: "simple-marker",&lt;BR /&gt;color: [0, 0, 255], // orange&lt;BR /&gt;outline: {&lt;BR /&gt;color: [0, 0, 0], // white&lt;BR /&gt;width: 1&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: map,&lt;BR /&gt;center: [-91.656674999999993, 42.028534999999991],&lt;BR /&gt;zoom: 14&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var track1 = new Track({&lt;BR /&gt;view: view,&lt;BR /&gt;graphic: new Graphic({&lt;BR /&gt;symbol: {&lt;BR /&gt;type: "simple-marker",&lt;BR /&gt;size: "12px",&lt;BR /&gt;color: "green",&lt;BR /&gt;outline: {&lt;BR /&gt;color: "#efefef",&lt;BR /&gt;width: "1.5px"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}),&lt;BR /&gt;useHeadingEnabled: false // Don't change orientation of the map&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;//view.ui.add(track1, "top-left");&lt;/P&gt;&lt;P&gt;view.when(function () {&lt;BR /&gt;// All the resources in the MapView and the map have loaded. Now execute additional processes&lt;BR /&gt;window.parent.disableTableLoader('vehicle_side_map_column');&lt;BR /&gt;showVehicleFaultsOnMap();&lt;BR /&gt;}, function (error) {&lt;BR /&gt;// Use the errback function to handle when the view doesn't load properly&lt;BR /&gt;console.log("The view's resources failed to load: ", error);&lt;BR /&gt;});&lt;BR /&gt;graphicsLayer = new GraphicsLayer();&lt;/P&gt;&lt;P&gt;view.popup.autoOpenEnabled = false;&lt;BR /&gt;view.on("click", function (event) {&lt;BR /&gt;debugger;&lt;BR /&gt;var screenPoint = {&lt;BR /&gt;x: event.x,&lt;BR /&gt;y: event.y&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// Search for graphics at the clicked location&lt;BR /&gt;view.hitTest(screenPoint).then(function (response) {&lt;BR /&gt;debugger;&lt;BR /&gt;if (response.results.length) {&lt;BR /&gt;for (var cnt = 0; cnt &amp;lt; response.results.length; cnt++) {&lt;BR /&gt;if (response.results[cnt].graphic !== undefined&lt;BR /&gt;&amp;amp;&amp;amp; response.results[cnt].graphic.attributes !== undefined&lt;BR /&gt;&amp;amp;&amp;amp; response.results[cnt].graphic.attributes.FaultName !== undefined) {&lt;BR /&gt;debugger;&lt;BR /&gt;var faultName = response.results[cnt].graphic.attributes["FaultName"];&lt;BR /&gt;var faultDateTime = response.results[cnt].graphic.attributes["FaultDateTime"];&lt;BR /&gt;view.popup.open({&lt;BR /&gt;location: event.mapPoint, // location of the click on the view&lt;BR /&gt;title: faultName+" Fault", // title displayed in the popup&lt;BR /&gt;content: "on " + faultDateTime // content displayed in the popup&lt;BR /&gt;});&lt;BR /&gt;return;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;function showVehicleFaultsOnMap() {&lt;BR /&gt;debugger;&lt;BR /&gt;if (window.parent.healthLocation != null || window.parent.healthLocation != undefined) {&lt;BR /&gt;var totalFaults = window.parent.healthLocation.length;&lt;/P&gt;&lt;P&gt;for (var cnt = 0; cnt &amp;lt; totalFaults; cnt++) {&lt;/P&gt;&lt;P&gt;var faultData = window.parent.healthLocation[cnt].split(",");&lt;/P&gt;&lt;P&gt;var lat = faultData[0].split(":")[1];&lt;BR /&gt;var long = faultData[1].split(":")[1];&lt;/P&gt;&lt;P&gt;var point = {&lt;BR /&gt;type: "point",&lt;BR /&gt;longitude: long,&lt;BR /&gt;latitude: lat&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var graphicsLayer = new GraphicsLayer();&lt;/P&gt;&lt;P&gt;var simpleMarkerSymbol = {&lt;BR /&gt;type: "picture-marker",&lt;BR /&gt;url: "/images/alert.png",&lt;BR /&gt;width: "24px",&lt;BR /&gt;height: "24px"&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var pointGraphic = new Graphic({&lt;BR /&gt;geometry: point,&lt;BR /&gt;symbol: simpleMarkerSymbol,&lt;BR /&gt;attributes: { "FaultName": faultData[2], "FaultDateTime": window.parent.healthLocationOccuredOn }&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;graphicsLayer.add(pointGraphic);&lt;/P&gt;&lt;P&gt;// Add text below the pin&lt;BR /&gt;var textGraphic = new Graphic({&lt;BR /&gt;geometry: {&lt;BR /&gt;type: "point",&lt;BR /&gt;longitude: long,&lt;BR /&gt;latitude: lat&lt;BR /&gt;},&lt;BR /&gt;symbol: {&lt;BR /&gt;type: "text",&lt;BR /&gt;color: [24, 24, 24],&lt;BR /&gt;haloColor: [254, 254, 254],&lt;BR /&gt;haloSize: "1px",&lt;BR /&gt;text: "",&lt;BR /&gt;xoffset: 0,&lt;BR /&gt;yoffset: -25,&lt;BR /&gt;font: {&lt;BR /&gt;size: 12&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;graphicsLayer.add(textGraphic);&lt;BR /&gt;map.add(graphicsLayer);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (totalFaults &amp;gt; 0) {&lt;BR /&gt;var firstFaultData = window.parent.healthLocation[0].split(",");&lt;BR /&gt;var centerLat = firstFaultData[0].split(":")[1];&lt;BR /&gt;var centerLong = firstFaultData[1].split(":")[1];&lt;/P&gt;&lt;P&gt;view.center = [centerLong, centerLat];&lt;BR /&gt;view.zoom = 10;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;window.streamObserver.subscribe(function (stream, partitionKey, module) {&lt;BR /&gt;if ("gps" == module) {&lt;BR /&gt;if (partitionKey == livePartitionKey) {&lt;/P&gt;&lt;P&gt;var gpsData = JSON.parse(stream);&lt;/P&gt;&lt;P&gt;var latitudeDegree = gpsData["LocationEventData"]["Latitude"]["Degree"];&lt;/P&gt;&lt;P&gt;var longitudeDegree = gpsData["LocationEventData"]["Longitude"]["Degree"];&lt;/P&gt;&lt;P&gt;updateLeftPanel(gpsData);&lt;/P&gt;&lt;P&gt;if (!isInitialized) {&lt;BR /&gt;startingLong = parseFloat(longitudeDegree);&lt;BR /&gt;startingLat = parseFloat(latitudeDegree);&lt;BR /&gt;isInitialized = true;&lt;BR /&gt;addStartingPointintoMap(startingLong, startingLat);&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var currentLong = parseFloat(longitudeDegree);&lt;BR /&gt;var currentLat = parseFloat(latitudeDegree);&lt;/P&gt;&lt;P&gt;vehicleLat = currentLat;&lt;BR /&gt;vehicleLong = currentLong;&lt;/P&gt;&lt;P&gt;if (isInitialized) {&lt;BR /&gt;var polyline2 = {&lt;BR /&gt;type: "polyline",&lt;BR /&gt;paths: [&lt;BR /&gt;[currentLong, currentLat],&lt;BR /&gt;[startingLong, startingLat]&lt;BR /&gt;]&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var polylineGraphic1 = new Graphic({&lt;BR /&gt;geometry: polyline2,&lt;BR /&gt;symbol: simpleLineSymbol&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var endPoint = {&lt;BR /&gt;type: "point",&lt;BR /&gt;longitude: currentLong,&lt;BR /&gt;latitude: currentLat&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var pointGraphic1 = new Graphic({&lt;BR /&gt;geometry: endPoint,&lt;BR /&gt;symbol: simpleMarkerSymbol&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;//graphicsLayer.add(pointGraphic1);&lt;BR /&gt;graphicsLayer.add(polylineGraphic1);&lt;/P&gt;&lt;P&gt;//var textGraphic1 = new Graphic({&lt;BR /&gt;// geometry: {&lt;BR /&gt;// type: "point",&lt;BR /&gt;// longitude: -91.656674999999993,&lt;BR /&gt;// latitude: 42.028534999999991&lt;BR /&gt;// },&lt;BR /&gt;// symbol: {&lt;BR /&gt;// type: "text",&lt;BR /&gt;// color: [25, 25, 25],&lt;BR /&gt;// haloColor: [255, 255, 255],&lt;BR /&gt;// haloSize: "1px",&lt;BR /&gt;// text: "This is my location!",&lt;BR /&gt;// xoffset: 0,&lt;BR /&gt;// yoffset: -25,&lt;BR /&gt;// font: {&lt;BR /&gt;// size: 12&lt;BR /&gt;// }&lt;BR /&gt;// }&lt;BR /&gt;//});&lt;/P&gt;&lt;P&gt;//graphicsLayer.add(textGraphic1);&lt;BR /&gt;map.add(graphicsLayer);&lt;/P&gt;&lt;P&gt;startingLong = parseFloat(currentLong);&lt;BR /&gt;startingLat = parseFloat(currentLat);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;function addStartingPointintoMap(long, lat) {&lt;/P&gt;&lt;P&gt;pictureGraphic = new Graphic({&lt;BR /&gt;geometry: {&lt;BR /&gt;type: "point",&lt;BR /&gt;longitude: long,&lt;BR /&gt;latitude: lat&lt;BR /&gt;},&lt;BR /&gt;symbol: {&lt;BR /&gt;type: "picture-marker",&lt;BR /&gt;url: "/images/circle.png",&lt;BR /&gt;width: "14px",&lt;BR /&gt;height: "14px"&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;graphicsLayer.add(pictureGraphic);&lt;BR /&gt;view.center = [long, lat]&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;function updateLeftPanel(locationXmlDoc) {&lt;BR /&gt;try {&lt;BR /&gt;var odometer = parseFloat(locationXmlDoc["LocationEventData"]["Extensions"]["Odometer"]).toFixed(1);&lt;BR /&gt;var speedOverGround = parseFloat(locationXmlDoc["LocationEventData"]["SpeedOverGround"]).toFixed(0);&lt;/P&gt;&lt;P&gt;window.parent.document.getElementById("odometer").innerHTML = isNaN(odometer) ? 0 : odometer;&lt;BR /&gt;window.parent.document.getElementById("speed").innerHTML = isNaN(speedOverGround) ? 0 : speedOverGround;&lt;BR /&gt;} catch (e) {&lt;BR /&gt;console.log("Can't find data for odometer and speed over ground");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;div id="viewDiv" style="cursor:pointer"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="container"&amp;gt;&lt;BR /&gt;&amp;lt;main role="main" class="pb-3"&amp;gt;&lt;BR /&gt;&amp;lt;/main&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 14:33:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023393#M71629</guid>
      <dc:creator>rajeshesri01</dc:creator>
      <dc:date>2021-02-04T14:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023405#M71631</link>
      <description>&lt;P data-unlink="true"&gt;You could use &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html#distance" target="_self"&gt;point.distance()&lt;/A&gt;&amp;nbsp;or geometry engine&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; or&amp;nbsp;geodesicUtils &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-geodesicUtils.html#geodesicDistance" target="_self"&gt;geodesicDistance()&lt;/A&gt;&amp;nbsp;or geometryEngineAsync &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngineAsync.html#distance" target="_self"&gt;distance()&lt;/A&gt; or geometry service &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-GeometryService.html#distance" target="_self"&gt;distance()&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 14:53:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023405#M71631</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-02-04T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023417#M71632</link>
      <description>&lt;P&gt;Thanks for replying , i tried but not success , can you please update above code, so that i get clear solution.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 15:17:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023417#M71632</guid>
      <dc:creator>rajeshesri01</dc:creator>
      <dc:date>2021-02-04T15:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023422#M71633</link>
      <description>&lt;P&gt;It helps to have a very simple CodePen showing just the code related to the issue so we can experience the problem and make suggestions.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 15:21:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023422#M71633</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2021-02-04T15:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023428#M71634</link>
      <description>&lt;P&gt;Even a short code will make big help.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 15:29:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023428#M71634</guid>
      <dc:creator>rajeshesri01</dc:creator>
      <dc:date>2021-02-04T15:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023435#M71635</link>
      <description>&lt;P&gt;I tried but all giving undefined/not a method error in JavaScript that's why it would be great if provided code.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 15:40:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023435#M71635</guid>
      <dc:creator>rajeshesri01</dc:creator>
      <dc:date>2021-02-04T15:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023486#M71638</link>
      <description>&lt;P&gt;Did you add the module in the &lt;FONT face="courier new,courier"&gt;require&lt;/FONT&gt; statement at the top?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 16:51:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023486#M71638</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-02-04T16:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023515#M71639</link>
      <description>&lt;P&gt;Yes , i tried.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 17:10:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023515#M71639</guid>
      <dc:creator>rajeshesri01</dc:creator>
      <dc:date>2021-02-04T17:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023618#M71646</link>
      <description>&lt;P&gt;Here's the basic format for using &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-geodesicUtils.html#geodesicDistance" target="_self"&gt;geodesicDistance()&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var firstPoint = new Point({
  longitude: -111.022887,
  latitude: 35.02741
});
var otherPoint = new Point({
  longitude: -111.122887,
  latitude: 35.12741
});
var distanceUnits = "kilometers";
var distanceResult = geodesicUtils.geodesicDistance(firstPoint, otherPoint, distanceUnits);
console.log(distanceResult.distance, distanceUnits);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again though, make sure you require&amp;nbsp;&lt;FONT face="courier new,courier"&gt;"esri/geometry/support/geodesicUtils"&lt;/FONT&gt; and include&amp;nbsp;&lt;FONT face="courier new,courier"&gt;geodesicUtils&lt;/FONT&gt; in the function parameters.&lt;/P&gt;&lt;P&gt;EDIT:&lt;BR /&gt;Sorry, forgot you'll also need to require&amp;nbsp;&lt;FONT face="courier new,courier"&gt;"esri/geometry/Point"&lt;/FONT&gt; and include &lt;FONT face="courier new,courier"&gt;Point&lt;/FONT&gt; in the function parameters for this particular example. Here's a sample app.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /&amp;gt;
    &amp;lt;title&amp;gt;Intro to MapView - Create a 2D map | Sample | ArcGIS API for JavaScript 4.18&amp;lt;/title&amp;gt;
    &amp;lt;style&amp;gt;
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    &amp;lt;/style&amp;gt;

    &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.18/esri/themes/light/main.css" /&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.18/"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script&amp;gt;
      require(["esri/Map", "esri/views/MapView", "esri/geometry/Point", "esri/geometry/support/geodesicUtils"],
      function(Map, MapView, Point, geodesicUtils) {
        // Set up basic map
        var map = new Map({
          basemap: "topo-vector"
        });
        var view = new MapView({
          container: "viewDiv",
          map: map,
          zoom: 4,
          center: [-111, 35] // longitude, latitude
        });
        
        // Define points for measurement
        var firstPoint = new Point({
          longitude: -111.022887,
          latitude: 35.02741
        });
        var otherPoint = new Point({
          longitude: -111.122887,
          latitude: 35.12741
        });
        
        // Measure distance and output result to console log
        var distanceUnits = "kilometers";
        var distanceResult = geodesicUtils.geodesicDistance(firstPoint, otherPoint, distanceUnits);
        console.log(distanceResult.distance, distanceUnits);
      });
    &amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;

  &amp;lt;body&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 20:44:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023618#M71646</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-02-04T20:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: I want to find a distance between 2 coordinates , using 4.16 JavaScript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023835#M71658</link>
      <description>&lt;P&gt;This worked , i including the modules at last. My be this creating a problem. Thanks for help.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 11:13:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/i-want-to-find-a-distance-between-2-coordinates/m-p/1023835#M71658</guid>
      <dc:creator>rajeshesri01</dc:creator>
      <dc:date>2021-02-05T11:13:29Z</dc:date>
    </item>
  </channel>
</rss>

