This sample demonstrates how to use the AGSTransformationCatalog to get a list of available AGSDatumTransformation that can be used to project an AGSGeometry between two different AGSSpatialReference, and how to use one of the transformations to perform the AGSGeometryEngine.project operation.
How it works
Optionally, begin by adding projection engine data to your device before running this sample. When you use the projection engine data, more transformations are available for use.
Tap on a listed transformation to reproject the point geometry (shown in red) using the selected transformation. The reprojected geometry will be shown in blue. If there are grid-based transformations for which projection engine files are not available on your device, these will be listed in an items details. The default transformation is highlighted in the list.
The sample sets the location of projection engine data on the device by calling AGSTransformationCatalog.setProjectionEngineDirectory. The list of AGSDatumTransformation objects is created by calling AGSTransformationCatalog.transformationsBySuitability, passing in the AGSSpatialReference of the original geometry (the input spatial reference) and that of the AGSMap (the output spatial reference). Depending on the state of a switch control, the current visible extent of the map is used to sort the list by suitability. When the user taps on a transformation in the list, the selected transformation is used to reproject an AGSPoint. The AGSGraphic's geometry is then updated with the new AGSPoint. If the selected transformation is not usable (has missing grid files) then no projected point is displayed.
This sample can be used with or without provisioning projection engine data to your device. If you do not provision data, a limited number of transformations will be available to you. To download projection engine data to your device:
- Log in to the ArcGIS for Developers site using your Developer account.
- In the Dashboard page, click 'Download APIs and SDKs'.
- Click the download button next to 'ArcGIS_Runtime_Coordinate_System_Data' to download projection engine data to your computer.
- Unzip the downloaded data on your computer.
- Copy the PEDataRuntime folder to your Documents folder.