<?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: How to populate Longitude/Latitude form fields 'onclick' and add location marker to map? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012443#M71202</link>
    <description>&lt;P&gt;Thanks Blake. How would I implement that within my code? I've searched everywhere for a working example/code but to no avail.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Dec 2020 14:41:53 GMT</pubDate>
    <dc:creator>SteveCheshire</dc:creator>
    <dc:date>2020-12-28T14:41:53Z</dc:date>
    <item>
      <title>How to populate Longitude/Latitude form fields 'onclick' and add location marker to map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012435#M71200</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;&lt;BR /&gt;I'm trying to build a wildlife recording form for a charity to collect wildlife sightings data and I would like to use ESRI maps to collect Longitude and Latitude location data. Unfortunately I'm very new to all this so learning on the job!&lt;BR /&gt;&lt;BR /&gt;I have an iframe containing the file &lt;STRONG&gt;record_map.php&lt;/STRONG&gt; that displays the map (see code below). When I click on the map, I want the the&amp;nbsp;Longitude and Latitude of that location to populate two html form fields in the parent document i.e.&amp;nbsp;&amp;lt;input type="number" id="Longitude" name="Longitude" value=""&amp;gt; and&amp;nbsp;&amp;lt;input type="number" id="Latitude" name="Latitude" value=""&amp;gt;.&lt;BR /&gt;&lt;BR /&gt;I also need to pin a graphic or point to the selected location on the map 'onclick' and for this to move to a new location if the user clicks a different place on the map?&lt;BR /&gt;&lt;BR /&gt;Any help would be very much appreciated. Huge thank you to anyone who can help.&lt;BR /&gt;Seasons greetings!&lt;/P&gt;&lt;P&gt;Steve&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here's the code for&amp;nbsp;&lt;STRONG&gt;record_map.php&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;html&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;head&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;meta charset="utf-8"&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;style&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;html, body, #viewDiv {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;padding: 0;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;margin: 0;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;height: 100%;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;width: 100%;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;/style&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/4.11/esri/css/main.css" target="_blank"&gt;https://js.arcgis.com/4.11/esri/css/main.css&lt;/A&gt;"&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;script src="&lt;A href="https://community.esri.com/" target="_blank"&gt;https://js.arcgis.com/4.11/"&amp;gt;&amp;lt;/script&lt;/A&gt;&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//LOAD LAYERS&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;require([&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"esri/tasks/Locator",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"esri/Map",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"esri/views/MapView",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"esri/Graphic",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"esri/layers/GraphicsLayer",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"esri/widgets/BasemapToggle",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"esri/widgets/BasemapGallery"&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;], function(Locator, Map, MapView, Graphic, GraphicsLayer, BasemapToggle, BasemapGallery) {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;// SET LOCATOR TASK USING WORLD GEOCODING SERVICE&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var locatorTask = new Locator({&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;url:&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"&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;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//LOAD INITIAL BASE LAYER TYPE&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var map = new Map({&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;basemap: "topo-vector"&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//LOCATE MAP CENTER AND ZOOM LEVEL&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var view = new MapView({&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;container: "viewDiv",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;map: map,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;center: [19.874268,39.576056], // longitude, latitude &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;zoom: 10&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//TOGGLE BASE LAYER TYPE&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var basemapToggle = new BasemapToggle({&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;view: view,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;nextBasemap: "satellite"&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//POSITION BASE LAYER TOGGLE&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;view.ui.add(basemapToggle, "bottom-left");&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//POSITION BASE LAYER TOGGLE&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var graphicsLayer = new GraphicsLayer();&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;map.add(graphicsLayer);&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//FORMAT RECORD POINT STYLE&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var simpleMarkerSymbol = {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;type: "simple-marker",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;color: [220, 53, 69, 1], // orange&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;outline: {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;color: [255, 255, 255, 1], // white&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;width: 2&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var pointGraphic = new Graphic({&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;geometry: point,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;symbol: simpleMarkerSymbol&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;graphicsLayer.add(pointGraphic);&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//LOAD OUTLINE POLYGON&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var polygon = {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;type: "polygon",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;rings: [&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;[ 19.6549, 39.7353 ], [ 19.6549, 39.7353 ]&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;]&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var simpleFillSymbol = {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;type: "simple-fill",&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;color: [0, 190, 90, 0.025], // CBC Green, opacity 2.5%&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;outline: {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;color: [0, 190, 90, 1],&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;width: 1&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var polygonGraphic = new Graphic({&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;geometry: polygon,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;symbol: simpleFillSymbol&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;graphicsLayer.add(polygonGraphic);&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;//LOAD AND FORMAT CO-ORDINATE WIDGET TO DISPLAY LONG/LAT, SCALE AND ZOOM LEVEL &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var coordsWidget = document.createElement("div");&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;coordsWidget.id = "coordsWidget";&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;coordsWidget.className = "esri-widget esri-component";&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;coordsWidget.style.padding = "7px 15px 5px";&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;view.ui.add(coordsWidget, "bottom-right");&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;function showCoordinates(pt) {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;var coords =&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;"Latitude " +&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;pt.latitude.toFixed(6) +&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;" | Longitude " +&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;pt.longitude.toFixed(6) +&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;" | Scale 1:" +&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;Math.round(view.scale * 1) / 1 +&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;" | Zoom " +&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;view.zoom;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;coordsWidget.innerHTML = coords;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;view.watch("stationary", function (isStationary) {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;showCoordinates(view.center);&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;view.on("pointer-move", function (evt) {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;showCoordinates(view.toMap({ x: evt.x, y: evt.y }));&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;/script&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;/head&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;body&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;/body&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&amp;lt;/html&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 14:17:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012435#M71200</guid>
      <dc:creator>SteveCheshire</dc:creator>
      <dc:date>2020-12-28T14:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate Longitude/Latitude form fields 'onclick' and add location marker to map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012438#M71201</link>
      <description>&lt;P&gt;The &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest" target="_self"&gt;hittest() method of MapView&lt;/A&gt; will have a mapPoint property in the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#HitTestResult" target="_self"&gt;HitTestResult&lt;/A&gt; that is returned. You can use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html#latitude" target="_self"&gt;latitude and longitude properties&lt;/A&gt; of the point.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 14:35:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012438#M71201</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2020-12-28T14:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate Longitude/Latitude form fields 'onclick' and add location marker to map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012443#M71202</link>
      <description>&lt;P&gt;Thanks Blake. How would I implement that within my code? I've searched everywhere for a working example/code but to no avail.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 14:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012443#M71202</guid>
      <dc:creator>SteveCheshire</dc:creator>
      <dc:date>2020-12-28T14:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to populate Longitude/Latitude form fields 'onclick' and add location marker to map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012445#M71203</link>
      <description>&lt;P&gt;There's two examples in the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest" target="_self"&gt;hittest() documentation&lt;/A&gt; section as well as a link to a sample app using hittest(). In your case, sounds like you want a click event so start with that example.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Get the screen point from the view's click event
view.on("click", function (event) {
  // Search for graphics at the clicked location. View events can be used
  // as screen locations as they expose an x,y coordinate that conforms
  // to the ScreenPoint definition.
  view.hitTest(event).then(function (response) {
    if (response.results.length) {
      var graphic = response.results.filter(function (result) {
        // check if the graphic belongs to the layer of interest
        return result.graphic.layer === myLayer;
      })[0].graphic;

      // do something with the result graphic
      console.log(graphic.attributes);
    }
  });
});&lt;/LI-CODE&gt;&lt;P&gt;Then you can display the mapPoint from HitTestResult as a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html" target="_self"&gt;graphic&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 14:48:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-populate-longitude-latitude-form-fields/m-p/1012445#M71203</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2020-12-28T14:48:45Z</dc:date>
    </item>
  </channel>
</rss>

