<?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: Creating Point based on user input in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225678#M79133</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7278"&gt;@JeffreyWilkerson&lt;/a&gt;&amp;nbsp;but this uses click action, I don't want that. I just want the user to type in the coordinates (let's say a text box) and then use those coordinates) and create a point layer and then append it&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 15:20:46 GMT</pubDate>
    <dc:creator>TheGamer</dc:creator>
    <dc:date>2022-10-26T15:20:46Z</dc:date>
    <item>
      <title>Creating Point based on user input</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225602#M79131</link>
      <description>&lt;P&gt;Hi, im new to Javascript API and I was wondering if there is a way to create a point by using the coordinates entered by the user and append that point layer to existing data (following the symbology of the data its being appended to).&lt;/P&gt;&lt;P&gt;I was using Editor Widget but I don't like the use of clicking on the map, I want to create points by using the coordinates entered into a text box.&lt;/P&gt;&lt;P&gt;If I could get documentation or a sample code, it would be greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 13:25:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225602#M79131</guid>
      <dc:creator>TheGamer</dc:creator>
      <dc:date>2022-10-26T13:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Point based on user input</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225670#M79132</link>
      <description>&lt;P&gt;&amp;nbsp;The Editor widget provides this function out of the box, and there are many examples. You can build the functionality yourself by first creating a point graphic under the view.hitTest() and then either immediately adding the point to a layer through its applyEdits() function, or building some kind of interface (menu, button) to have the user accept this new point and then push it through applyEdits().&amp;nbsp; I have one application where I use the Editor to edit only existing features, and if the user hits a button before picking a point on the screen, the point is generated and pushed to the layer, something like:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.on("immediate-click", (event) =&amp;gt; {

    // Listen for when the user clicks on the view
    view.hitTest(event).then((response) =&amp;gt; {
        let curPt = view.toMap(response.screenPoint);
        let graphics = response.results.filter(function (result) {
            // check if the graphic belongs to the layer of interest
            return result.graphic.layer === busStopLayer;
        });

        if (highlight) {
            highlight.remove();
            highlight = null;
        }

        if (getStreetView) {
            ... Can do other things if not wanting to create a new point
        else if (graphics.length &amp;gt; 0) {
            ... the user selected an existing graphic, handle it
        else if (addStopReady &amp;amp;&amp;amp; juris != "None") {
            // Clear current graphics layer (specified upon initialization)
            if (gLayer) {
                gLayer.removeAll();
            }

            // Generate new stop ID
            ...

            // Populate attributes for new point
            let attributes = {};
            attributes["StopID"] = newStopID;
            attributes["Juris"] = juris;
            attributes["Status"] = "Requested";
            attributes["Long"] = curPt.longitude;
            attributes["Lat"] = curPt.latitude;
        
            // Build new point graphic
            let newPoint = new Graphic({
                attributes: attributes,
                geometry: curPt
            });

            var newObjectId = 0;
            theLayer.applyEdits({
                addFeatures: [newPoint]
            }).then((editResult) =&amp;gt; {
                console.log(editResult);
                if (editResult.addFeatureResults.length &amp;gt; 0) {
                    // New point was successfully added, get the new objectID
                    newObjectId = editResult.addFeatureResults[0]["objectId"];
                    console.log("Added new bus stop with objectID: ", newObjectId);
                    theLayer.refresh(); //Esri says this is not needed, but it seems to help.
                })
                .catch(function (error) {
                    console.error("New bus stop ID Error: " + error);
            });
        }
    });
});&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Oct 2022 15:04:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225670#M79132</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2022-10-26T15:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Point based on user input</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225678#M79133</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7278"&gt;@JeffreyWilkerson&lt;/a&gt;&amp;nbsp;but this uses click action, I don't want that. I just want the user to type in the coordinates (let's say a text box) and then use those coordinates) and create a point layer and then append it&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 15:20:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225678#M79133</guid>
      <dc:creator>TheGamer</dc:creator>
      <dc:date>2022-10-26T15:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Point based on user input</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225681#M79134</link>
      <description>&lt;P&gt;Take the coordinates, create a new point, and then add it to the layer using the applyEdits() function.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 15:22:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-point-based-on-user-input/m-p/1225681#M79134</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2022-10-26T15:22:44Z</dc:date>
    </item>
  </channel>
</rss>

