<?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: Get Geocode (x, y) from Sketch Layer graphic (point) in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169114#M1579</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just to be clear this was the ticket.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;AGSGeometry *currentSketchValue2 = (AGSEnvelope*)AGSGeometryWebMercatorToGeographic(self.sketchLayer.geometry);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Apr 2013 17:56:00 GMT</pubDate>
    <dc:creator>JoshuaPowell1</dc:creator>
    <dc:date>2013-04-19T17:56:00Z</dc:date>
    <item>
      <title>Get Geocode (x, y) from Sketch Layer graphic (point)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169111#M1576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are attempting to get a geocode (i.e., longitude, latitude) from the sketch layer. To date we have been successful in getting the X and Y from the point but they look like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;89569.25265 45236.32566&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This obviously is not even close to being a geocode (i.e., longitude, latitude), at least not in my normal line of thinking.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now we're using a notification to use respondToGeomChanged [see below]:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(respondToGeomChanged:) name:AGSSketchGraphicsLayerGeometryDidChangeNotification object:nil];&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That method, when called, fires, gets the geometry information from the sketchLayer that we've already instantiated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;self.sketchLayer.geometry&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If we simply put that in a log, we can find out that it's a mutable point ... and from there we can build that out appropriately:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;AGSMutablePoint *currentSketchValue = self.sketchLayer.geometry;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now that we have an AGSMutablePoint the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/runtime-ios-sdk/apiref/interface_a_g_s_mutable_point.html" rel="nofollow" target="_blank"&gt;documentation from Esri for version 10.1 of the SDK&lt;/A&gt;&lt;SPAN&gt; we see we have access to an X (double) and a Y (double) ... but these are not longitude and latitude. These are the numbers that I showed above.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do we either A) get the longitude and latitude or B) convert the AGSMutablePoint X &amp;amp; Y to a longitude and latitude?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 19:04:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169111#M1576</guid>
      <dc:creator>JoshuaPowell1</dc:creator>
      <dc:date>2013-04-18T19:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get Geocode (x, y) from Sketch Layer graphic (point)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169112#M1577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Following up with a few details. The information that I'm receiving is a mutable point (i.e., AGSMutablePoint). When displayed in the debugger we get:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;AGSMutablePoint:
x = -13628019.829820,
y = 4549121.863850,
spatial reference: [
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSSpatialReference: wkid = 102100,
&amp;nbsp;&amp;nbsp;&amp;nbsp; wkt = null
]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Questions:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Why are those X and Y coordinates not a simple GeoCode (e.g., latitude, longitude)?&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;More importantly can I just convert those numbers or does something else need to happen?&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:47:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169112#M1577</guid>
      <dc:creator>JoshuaPowell1</dc:creator>
      <dc:date>2021-12-11T08:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get Geocode (x, y) from Sketch Layer graphic (point)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169113#M1578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out what was going on. It appears that my Feature Layer was set to WGS 4326 and the Sketch Layer defaults to Web Mercator. To resolve this I passed my Sketch Layers geometry information through the AGSGeometryWebMercatorToGeographic utility method and out came the correct geocode (i.e., latitude, longitude.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you'd like to try this out, I was using the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;- (void) didOpenWebMap:(AGSWebMap *)webMap intoMapView:(AGSMapView *)mapView {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ...&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(respondToGeomChanged:) name:AGSSketchGraphicsLayerGeometryDidChangeNotification object:nil];&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ...&amp;nbsp; }&amp;nbsp; - (void)respondToGeomChanged: (NSNotification*) notification {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if([self.sketchLayer.geometry isValid] &amp;amp;&amp;amp; ![self.sketchLayer.geometry isEmpty]) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSGeometry *currentSketchValue2 = (AGSEnvelope*)AGSGeometryWebMercatorToGeographic(self.sketchLayer.geometry); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSLog(@"AGSGeometryWebMercatorToGeographic: %@", currentSketchValue2);&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; } }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Apr 2013 17:54:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169113#M1578</guid>
      <dc:creator>JoshuaPowell1</dc:creator>
      <dc:date>2013-04-19T17:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Get Geocode (x, y) from Sketch Layer graphic (point)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169114#M1579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just to be clear this was the ticket.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;AGSGeometry *currentSketchValue2 = (AGSEnvelope*)AGSGeometryWebMercatorToGeographic(self.sketchLayer.geometry);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Apr 2013 17:56:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169114#M1579</guid>
      <dc:creator>JoshuaPowell1</dc:creator>
      <dc:date>2013-04-19T17:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get Geocode (x, y) from Sketch Layer graphic (point)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169115#M1580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This thread also shed a bit of light on things.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/15226-Project-AgsPoint-(spatial-reference-4326-to-spatial-reference-102100)"&gt;http://forums.arcgis.com/threads/15226-Project-AgsPoint-(spatial-reference-4326-to-spatial-reference-102100)&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Apr 2013 18:08:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/get-geocode-x-y-from-sketch-layer-graphic-point/m-p/169115#M1580</guid>
      <dc:creator>JoshuaPowell1</dc:creator>
      <dc:date>2013-04-19T18:08:29Z</dc:date>
    </item>
  </channel>
</rss>

