<?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: Draw using GPS position in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227690#M2088</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you taken a look at the &lt;/SPAN&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=3c396e21abac4273bffa9e4918a309a7"&gt;GPS sketching sample&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jan 2013 16:10:25 GMT</pubDate>
    <dc:creator>DiveshGoyal</dc:creator>
    <dc:date>2013-01-29T16:10:25Z</dc:date>
    <item>
      <title>Draw using GPS position</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227689#M2087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to create a similar GPS workflow as in ArcGIS Online iOS Application. Basically I have a GPS button and a add point button, when GPS button is on, map shows GPS poisition and tap on satellite button adds a point on the map and this part works fine for me. Next, if user taps add point button the what it should do is &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Take you GPS location&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Add point then&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Action code for Add Point is &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;self.sketLayer.geometry =&amp;nbsp; Mutable Type........&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is set to point,line or polygon based on user selection in different method&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp; - (IBAction)addGPSPoint:(id)sender{&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!self.mapView.gps.enabled){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.mapView.gps start];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.mapView.gps.autoPanMode = AGSGPSAutoPanModeDefault;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.mapView.gps.wanderExtentFactor = 0.75;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.mapView.gps.navigationPointHeightFactor = 0.8;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIImage *gpsImg2 = [UIImage imageNamed:@"onGPS.png"];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.gpsButton setBackgroundImage:gpsImg2 forState:UIControlStateNormal];
&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; AGSPoint *gpsPoint = [self.mapView.gps currentPoint];
&amp;nbsp;&amp;nbsp;&amp;nbsp; AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:26915];
&amp;nbsp;&amp;nbsp;&amp;nbsp; if([self.sketchLayer.geometry isKindOfClass:[AGSMutablePolyline class]]){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.sketchLayer.geometry addPointToPath:[AGSPoint pointWithX:gpsPoint.x y:gpsPoint.y spatialReference:sr]];
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; else if([self.sketchLayer.geometry isKindOfClass:[AGSMutablePolygon class]]){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.sketchLayer.geometry addPointToRing:[AGSPoint pointWithX:gpsPoint.x y:gpsPoint.y spatialReference:sr]];
&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; else{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.sketchLayer.geometry = [AGSPoint pointWithX:gpsPoint.x y:gpsPoint.y spatialReference:sr];
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSLog(@"%@",self.sketchLayer.geometry);
&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.sketchLayer dataChanged];


}


&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;whats happening is that &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) point doesn't get added if sketch geometry is currently empty (i.e. adding first vertex of geometry using GPS)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) If suppose there are already a line with 2 vertices on the map and I try to add third point using GPS, Line goes somewhere outside the map area to unknown vertex.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there anyone who known how to implement this correctly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Vik&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2013 19:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227689#M2087</guid>
      <dc:creator>VIKRANTKRISHNA</dc:creator>
      <dc:date>2013-01-28T19:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Draw using GPS position</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227690#M2088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you taken a look at the &lt;/SPAN&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=3c396e21abac4273bffa9e4918a309a7"&gt;GPS sketching sample&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 16:10:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227690#M2088</guid>
      <dc:creator>DiveshGoyal</dc:creator>
      <dc:date>2013-01-29T16:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Draw using GPS position</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227691#M2089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having some trouble in running GPS Sketch sample on my mac. Although , I found this &lt;/SPAN&gt;&lt;A href="http://stackoverflow.com/questions/11791888/arcgis-current-location"&gt;http://stackoverflow.com/questions/11791888/arcgis-current-location&lt;/A&gt;&lt;SPAN&gt; , seems to be working better , but I am still getting some weird drawing when drawing Line .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will post back once I get the GPS sample working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2013 19:50:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227691#M2089</guid>
      <dc:creator>VIKRANTKRISHNA</dc:creator>
      <dc:date>2013-02-05T19:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Draw using GPS position</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227692#M2090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;BR /&gt;...whats happening is that &lt;BR /&gt;1) point doesn't get added if sketch geometry is currently empty (i.e. adding first vertex of geometry using GPS)&lt;BR /&gt;2) If suppose there are already a line with 2 vertices on the map and I try to add third point using GPS, Line goes somewhere outside the map area to unknown vertex.&lt;BR /&gt;&lt;BR /&gt;Is there anyone who known how to implement this correctly?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Vik&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am about 100% certain this is a projection issue; your returned gps points are provided in a different spatial reference than the map is using. For case 1), the gps point is in the wrong spatial reference and therefor draws somewhere outside the extent of the map and is never seen. For case 2), the first two vertices are in the correct spatial reference, but the added gps vertex is not and so the line draws off to wherever the point is outside the coordinate system / spatial reference the map is using. Check the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AGSSpatialReference&lt;/SPAN&gt;&lt;SPAN&gt; of the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AGSPoints&lt;/SPAN&gt;&lt;SPAN&gt; points you are getting back from the gps against that of the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AGSMapView&lt;/SPAN&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm pretty sure that gps points or user tap points from &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AGSMapView&lt;/SPAN&gt;&lt;SPAN&gt; are always returned in wgs84 / wkid 4326. If the first layer you added to the AGSMapView is an &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AGSTiledMapServiceLayer&lt;/SPAN&gt;&lt;SPAN&gt; in the popular web mercator / wkid 102100 projection, your &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AGSMapView&lt;/SPAN&gt;&lt;SPAN&gt; will use web mercator as its spatial reference. That mismatch would create this behavior; geometries are not currently reprojected on the fly by the Runtime SDK. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I posted some sample code in &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/76579-Drawing-Graphics-on-Different-esri-Basemaps?p=269198&amp;amp;viewfull=1#post269198"&gt;this thread&lt;/A&gt;&lt;SPAN&gt; about a different issue arising from spatial reference mismatches. It shows the basics of checking spatial references against each other and reprojecting using &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AGSGeometryEngine&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2013 20:41:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/draw-using-gps-position/m-p/227692#M2090</guid>
      <dc:creator>DanaMaher</dc:creator>
      <dc:date>2013-02-06T20:41:33Z</dc:date>
    </item>
  </channel>
</rss>

