<?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: Rotation Of Maps in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376690#M3238</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Beda,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been looking for this function for a long time and your approach works gr8.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jul 2011 11:06:00 GMT</pubDate>
    <dc:creator>SandeepKuniel</dc:creator>
    <dc:date>2011-07-28T11:06:00Z</dc:date>
    <item>
      <title>Rotation Of Maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376686#M3234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am currently working on a project to combine the ArcGIS on the iPad with ArcGIS running on a multitouch tabletop. One of our goals is to have the iPad "line up" with the underlying map when it's placed onto the table. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To accomplish this I would need to rotate the map with the same orientation as the iPad had relative to the tabletop. Is this possible to do using the API?&amp;nbsp; The use of envelopes seems to imply that "up" on the iPad is always north. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any advice? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 23:06:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376686#M3234</guid>
      <dc:creator>ChrisBurns</dc:creator>
      <dc:date>2010-10-20T23:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Rotation Of Maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376687#M3235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;im trying to rotate the map based on data returned from GPS,, is there any way rotate maps on IOS devices ??&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2011 16:39:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376687#M3235</guid>
      <dc:creator>NoureddineEl-zaatari</dc:creator>
      <dc:date>2011-06-09T16:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rotation Of Maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376688#M3236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your feedback.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Map rotation is currently not supported (v2.0).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We hope to support it in an upcoming version.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2011 16:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376688#M3236</guid>
      <dc:creator>DiveshGoyal</dc:creator>
      <dc:date>2011-07-22T16:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rotation Of Maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376689#M3237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rotation of MapView can be implemented by setting mapView.transform = CGAffineTransformMakeRotation(alpha). This rotates the full mapView (including Callout, graphics...) on UIView-Base and can be hanged on your Compass with use of CLLocationManager.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can try my code in "ZüriPlan" - App available on App Store.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PS: I block Interface rotation when Compass is active. Its a mess! Also deactivate Compass when Pushing your map away with NavigationController or if you leave MapView through TabViewController. Deactivate it when leaving the App or push the Standby button (AppDelegate Functions...) it's very Energy-hungry &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My Code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interface:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;@Interface MapViewController:UIViewController&amp;lt;CLLocationManagerDelegate&amp;gt;
//CLLocationManagerDelegate provides functions to listen to Heading/GPS Change
{
....

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CGRect originalMapViewFrame; // Save the current mapView Size here
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IBOutlet AGSMapView *mapView; //your AGSMapView Reference...

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLLocationManager *locationManager; //locationManager Instance


...

}


//Serve your LocationManager as retained Property to manage your Memory correctly, don't forgett to release it in your dealloc-Funciton
@property(retain) CLLocationManager *locationManager;


@end&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Implementation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;@implementation MapViewController
@synthesize locationManager; //generate property code
...

-(void) startHeading
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //locationManager is an Object of Type CLLocationManager -&amp;gt; import CoreLocation
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!self.locationManager) {
&amp;nbsp; self.locationManager = [[[CLLocationManager alloc] init]autorelease];
&amp;nbsp; self.locationManager.delegate = self;
 }

&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; // First: Backup current mapview Size. It will be restored on stopHeading
 CGPoint origin = self.mapView.frame.origin;
 CGSize size = self.mapView.frame.size;
&amp;nbsp; 
 originalMapViewFrame = CGRectMake(origin.x, origin.y, size.width, size.height);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Blow up your map to a Square, this will hide white Areas when rotating your map
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //The new size will be the diagonal length using Phytagoras...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CGFloat newWidth = floor(sqrt(pow(size.width, 2) + pow(size.height, 2)));
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Calculate new x and y origins&amp;nbsp; 
 CGFloat x = origin.x - ((newWidth - size.width) /2);
 CGFloat y = origin.y - ((newWidth - size.height) /2);
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set the new Layoutinformation to your mapView
 self.mapView.frame = CGRectMake(x, y, newWidth, newWidth);
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //tell your LocationManager to start the updating
 [self.locationManager startUpdatingHeading];

}

//Will be called from locationManager and updates every Heading Changed
-(void) locationManager: (CLLocationManager *)manager didUpdateHeading: (CLHeading *)newHeading
{
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get your magneticHeading. If you need the "true" heading, use newHeading.trueHeading instead. But trueHeading only works, if GPS is enabled for your App and your Device is GPS ready...
 float heading = newHeading.magneticHeading;
 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // You can use this block for smoother Rotation using a UIView Animation
 [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()];
 [UIView setAnimationCurve:UIViewAnimationCurveLinear];
 [UIView setAnimationDuration:0.05];
 
 //make some math (radial to degree or something...)
 float rotation = -1.0f * M_PI * (heading) / 180.0f;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Apply a rotation Transform to your map
 self.mapView.transform = CGAffineTransformMakeRotation( rotation);
 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Commit the animation
 [UIView commitAnimations];
 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // if you need actual heading somewhere else, save it. otherwise you don't need this
 self.heading = rotation; 
}

//Stops heading
-(void) stopHeading
{
&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; [self.locationManager stopUpdatingHeading];
&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;&amp;nbsp; //Remove Rotate Animation
&amp;nbsp; self.mapView.transform = CGAffineTransformMakeRotation(0);
&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; // Restore original Framedata for your mapView
&amp;nbsp; self.mapView.frame = originalMapViewFrame;

}
@end&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:24:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376689#M3237</guid>
      <dc:creator>BedaKuster</dc:creator>
      <dc:date>2021-12-11T17:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rotation Of Maps</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376690#M3238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Beda,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been looking for this function for a long time and your approach works gr8.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 11:06:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/rotation-of-maps/m-p/376690#M3238</guid>
      <dc:creator>SandeepKuniel</dc:creator>
      <dc:date>2011-07-28T11:06:00Z</dc:date>
    </item>
  </channel>
</rss>

