<?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: Using geometryEngine projectGeometry results in strange results in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399674#M3435</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;- Which way should I map X/Y to lat/long (in all other examples I saw X-&amp;gt;lat and Y-&amp;gt;lng but it does not give any result)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;X = Longitude and Y = Latitude.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;- Am I doing it the right way or missing anything?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are doing it right. I projected point and got slight difference in the result point but it looks correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSPoint *p = [AGSPoint pointWithX:166.442 y:-22.2682 spatialReference:[AGSSpatialReference wgs84SpatialReference]];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSGeometry *pg = [[AGSGeometryEngine defaultGeometryEngine] projectGeometry:p toSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:3163]];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NSLog(@"%@",pg);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//AGSMutablePoint: x = 445554.767830, y = 214880.208082, spatial reference: [AGSSpatialReference: wkid = 3163, wkt = null]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, look into why you are getting point out of map's bounds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is your map's spatial reference?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you creating a graphic with projected point and adding to graphics layer to visualize it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 May 2013 16:10:04 GMT</pubDate>
    <dc:creator>NimeshJarecha</dc:creator>
    <dc:date>2013-05-21T16:10:04Z</dc:date>
    <item>
      <title>Using geometryEngine projectGeometry results in strange results</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399673#M3434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I looked in the other threads and cannot find anything about this problem. Maybe it's my misunderstanding of the way to project a point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to convert device's latitude and longitude to my map which is in a 3163 spatial reference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do the following :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt; Get the current location from SDK's CoreLocation framework&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; When I need to plot a point on current location, I initialize the current lat/long as an AGSPoint with a WGS84 spatial reference.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; Then I project it to the spatial reference 3163 and I add this point to one of my graphic layer&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;This results in the point being misplaced all the time. I first tried the following :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp; _defaultSpatialRef = [AGSSpatialReference spatialReferenceWithWKID:3163];&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; AGSGeometryEngine *engine = [AGSGeometryEngine defaultGeometryEngine]; &amp;nbsp;&amp;nbsp;&amp;nbsp; AGSPoint *point = [AGSPoint pointWithX:currentLocation.coordinate.latitude y:currentLocation.coordinate.longitude spatialReference:[AGSSpatialReference spatialReferenceWithWKID:WKID_WGS84]]; &amp;nbsp;&amp;nbsp;&amp;nbsp; AGSPoint *projectedPoint= (AGSPoint*)[engine projectGeometry:point toSpatialReference:_defaultSpatialRef];&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This sample code always result in returning "nan" information in the resulting AGSpoint x and y coordinates. Because I was not sure how to map X and Y as latitude and longitude I tried to switch lat / long so that X is mapped to longitude and Y mapped to latitude in my origin WGS84 point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This time, I get results but the resulting point seems to be outside my map's bounds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are my information :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;location latitude = -22.2682&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;location longitude = 166.442&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;First try when mapping X with latitude and Y with longitude in my initial point that I project =&amp;gt; nan / nan as resulting projected AGSPoint X and Y &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Second try when mapping X with longitude and Y with latitude :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;projected point X = 445586.569662&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;projected point Y = 214879.873427&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;I think my X should be negative but not sure.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are my questions : &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Which way should I map X/Y to lat/long (in all other examples I saw X-&amp;gt;lat and Y-&amp;gt;lng but it does not give any result)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Am I doing it the right way or missing anything ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your time and answers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Christophe.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 00:27:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399673#M3434</guid>
      <dc:creator>ChristopheFondacci</dc:creator>
      <dc:date>2013-05-13T00:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using geometryEngine projectGeometry results in strange results</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399674#M3435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;- Which way should I map X/Y to lat/long (in all other examples I saw X-&amp;gt;lat and Y-&amp;gt;lng but it does not give any result)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;X = Longitude and Y = Latitude.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;- Am I doing it the right way or missing anything?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are doing it right. I projected point and got slight difference in the result point but it looks correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSPoint *p = [AGSPoint pointWithX:166.442 y:-22.2682 spatialReference:[AGSSpatialReference wgs84SpatialReference]];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AGSGeometry *pg = [[AGSGeometryEngine defaultGeometryEngine] projectGeometry:p toSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:3163]];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NSLog(@"%@",pg);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//AGSMutablePoint: x = 445554.767830, y = 214880.208082, spatial reference: [AGSSpatialReference: wkid = 3163, wkt = null]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, look into why you are getting point out of map's bounds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is your map's spatial reference?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you creating a graphic with projected point and adding to graphics layer to visualize it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 16:10:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399674#M3435</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2013-05-21T16:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using geometryEngine projectGeometry results in strange results</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399675#M3436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp; _defaultSpatialRef = [AGSSpatialReference spatialReferenceWithWKID:3163];

&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSGeometryEngine *engine = [AGSGeometryEngine defaultGeometryEngine];
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSPoint *point = [AGSPoint pointWithX:currentLocation.coordinate.latitude y:currentLocation.coordinate.longitude spatialReference:[AGSSpatialReference spatialReferenceWithWKID:WKID_WGS84]];
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSPoint *pointProjectedToWGS84 = (AGSPoint *)[engine projectGeometry:point toSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:WKID_WGS84]];
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSPoint *projectedPoint= (AGSPoint*)[engine projectGeometry:pointProjectedToWGS84 toSpatialReference:_defaultSpatialRef];
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i don't really know why but i encountered this problem too and had to project the point to WGS84 before i can project it to my desired spatial reference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399675#M3436</guid>
      <dc:creator>DavidMorrison1</dc:creator>
      <dc:date>2021-12-11T18:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using geometryEngine projectGeometry results in strange results</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399676#M3437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, actually the first code I posted seems to work now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I was manipulating the coordinates with incorrect datatypes, so my coordinates were truncated before being plotted on my map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything works great now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Christophe.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 May 2013 04:16:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/using-geometryengine-projectgeometry-results-in/m-p/399676#M3437</guid>
      <dc:creator>ChristopheFondacci</dc:creator>
      <dc:date>2013-05-27T04:16:03Z</dc:date>
    </item>
  </channel>
</rss>

