Map Rotation Sample

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data for Desktop

Map Rotation

The purpose of this sample is to show how to get the map rotation angle while using the pinch gesture to rotate the map. The sample also has a compass that rotates with the map.

Sample Design

The sample has a MapView and a basic WorldMap for a basemap. The tiled map service layer points to a map service on one of ESRI’s servers.

When the sample application starts, go ahead and use the pinch gesture to rotate the map. When the map rotates the compass on the map will also rotate. In order to get the map to its original orientation, single tap anywhere on the map.

The pinch listener is added to the map and the value of the degree of rotation can get be obtained from one of the arguments of this listener.

The compass is added to an additional view class, this part is really optional. In this view class the compass is added as a bitmap, the resource for which is situated in the /res/drawable folder. The compass rotates as the map rotates along its own center point.

How to use the sample

Steps:
  1. Launch the sample on your device.
  2. Using the pinch gesture rotate the map.
  3. Single tap on the map for original orientation.
5/31/2012