<?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: Editor - OnDrawComplete in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458784#M42368</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0020/0020000000p7000000.htm"&gt;OnCreateFeatureEventHandler&lt;/A&gt; is only for ArcObjects - this question relates to the JavaScript API &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rene has the right approach hooking in to the draw-end event of the &lt;A href="https://developers.arcgis.com/javascript/jsapi/draw-amd.html"&gt;Draw toolbar&lt;/A&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Also, since the update on editor is done automatically, I am wondering if there could be an event handler for editor complete or update complete!?&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Are you referring to when the locator has returned a result or something else here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rene's example logs the address result to the console window but you could also store it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Feb 2015 04:23:44 GMT</pubDate>
    <dc:creator>OwenEarley</dc:creator>
    <dc:date>2015-02-02T04:23:44Z</dc:date>
    <item>
      <title>Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458781#M42365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have this logic that I am trying to accomplish: I would like to get the centroid point of the polygon after being created and then perform the reverse geocode from that point to get informtions such as the full address, the county and township.&lt;/P&gt;&lt;P&gt;Any advice on accomplishing this?&lt;/P&gt;&lt;P&gt;Also, since the update on editor is done automatically, I am wondering if there could be an event handler for editor complete or update complete!?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2015 00:40:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458781#M42365</guid>
      <dc:creator>RichardMoussopo</dc:creator>
      <dc:date>2015-02-01T00:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458782#M42366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;public event&lt;/STRONG&gt; &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0020/0020000000p7000000.htm" rel="/en/sdk/10.0/arcobjects_net/componenthelp/0020/0020000000p7000000.htm" style="color: #106790; text-decoration: underline;"&gt;OnCreateFeatureEventHandler&lt;/A&gt; &lt;STRONG&gt;OnCreateFeature&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is help page (didn't find current doc, but the syntax is the same)&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Edit_event_listener/000100000230000000/" title="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Edit_event_listener/000100000230000000/"&gt;ArcObjects 10 .NET SDK Help&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Listen to that event, get the feature, calculate center, do reversegeocodemagic, profit!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2015 13:57:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458782#M42366</guid>
      <dc:creator>TeroRönkkö</dc:creator>
      <dc:date>2015-02-01T13:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458783#M42367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can grab the centroid of the polygon geometry and use that with the &lt;A href="https://developers.arcgis.com/javascript/jsapi/locator-amd.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Locator task&lt;/A&gt; to find the address.&lt;/P&gt;&lt;P&gt;You'll want to use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/locator-amd.html#locationtoaddress" rel="nofollow noopener noreferrer" target="_blank"&gt;locationToAddress &lt;/A&gt;method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would look something like this&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//somewhere add listener
tb = new Draw(map);
tb.on("draw-end", addGraphic);

// listener method
function addGraphic(evt) {
&amp;nbsp; var pt = evt.geometry.getCentroid();
&amp;nbsp; locator.locationToAddress(pt, 100).then(function(addresses) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.debug('Address Results', addresses);
&amp;nbsp; });
&amp;nbsp; map.graphics.add(new Graphic(evt.geometry, symbol));
}&lt;/PRE&gt;&lt;P&gt;I tried making a &lt;A href="http://jsbin.com/duhazulume/1/" rel="nofollow noopener noreferrer" target="_blank"&gt;JSBIN &lt;/A&gt;to demonstrate, but you need to add a proxy to use the Locator Task service, so it won't work in entirely, but should give you a good start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:25:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458783#M42367</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-11T20:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458784#M42368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0020/0020000000p7000000.htm"&gt;OnCreateFeatureEventHandler&lt;/A&gt; is only for ArcObjects - this question relates to the JavaScript API &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rene has the right approach hooking in to the draw-end event of the &lt;A href="https://developers.arcgis.com/javascript/jsapi/draw-amd.html"&gt;Draw toolbar&lt;/A&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Also, since the update on editor is done automatically, I am wondering if there could be an event handler for editor complete or update complete!?&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Are you referring to when the locator has returned a result or something else here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rene's example logs the address result to the console window but you could also store it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 04:23:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458784#M42368</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2015-02-02T04:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458785#M42369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh, sorry for confusing. I have lot to learn from this Geonet - I didn't notice the TOPIC of the discussion at all &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 05:30:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458785#M42369</guid>
      <dc:creator>TeroRönkkö</dc:creator>
      <dc:date>2015-02-02T05:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458786#M42370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Dene. &lt;/P&gt;&lt;P&gt;I am trying your approach which I think should be able to work. &lt;/P&gt;&lt;P&gt;the getCentroid method works fine but when calling the reverse geocode I get this error: Invalid query parameters which I believe may be related to the coordinates x and y?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="getCentroid.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/57846_getCentroid.PNG" style="width: 620px; height: 140px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 16:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458786#M42370</guid>
      <dc:creator>RichardMoussopo</dc:creator>
      <dc:date>2015-02-02T16:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458787#M42371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're going to want to use &lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.geometry.webmercatorutils-amd.html"&gt;webMercatorUtils&lt;/A&gt; to convert the pt to match the GeocodeServer. That should work in &lt;EM&gt;most&lt;/EM&gt; cases.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 18:56:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458787#M42371</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2015-02-02T18:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458788#M42372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rene,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry I am still having problems with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code &lt;/P&gt;&lt;P&gt;&amp;nbsp; map.graphics.add(new Graphic(evt.geometry, symbol));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var point = evt.geometry.getCentroid();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var point2 = new esri.geometry.Point(Number(point.x), Number(point.y), map.spatialReference);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mp = esri.geometry.geographicToWebMercator(point2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(point2.x + " , " + point2.y);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(mp);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and here is the output : and it is still failing when calling locator.locationToAddress()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="getCentroidReversegeocode.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/59471_getCentroidReversegeocode.PNG" style="width: 620px; height: 129px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 20:37:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458788#M42372</guid>
      <dc:creator>RichardMoussopo</dc:creator>
      <dc:date>2015-02-06T20:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Editor - OnDrawComplete</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458789#M42373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; What is the Spatial Reference of the evt that you are getting back? In your code you are creating an new point and setting the new points SR to the maps and then using ToWebMercator. So if the map is already 102100 then this process is not right. What SR is your GeoCodeServer using?&lt;/P&gt;&lt;P&gt;If you GeocodeServer allows Geographic coords (i.e 4326) the you can use this line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14233199889589171" jivemacro_uid="_14233199889589171" modifiedtitle="true"&gt;&lt;P&gt;&lt;SPAN class="pln"&gt;locator&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;locationToAddress&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;webMercatorUtils&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;webMercatorToGeographic&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;evt&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;mapPoint&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;),&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit"&gt;10&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Feb 2015 14:40:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-ondrawcomplete/m-p/458789#M42373</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-02-07T14:40:34Z</dc:date>
    </item>
  </channel>
</rss>

