Implementing OSTN02 NTv2 in ArcGIS Runtime SDK for WPF 10.1.1

Retired
20th September 2013

In a previous article we have shown how to add the NTv2 files to ArcGIS for Desktop to use the OSGB_1936_To_WGS_1984_7 transformation, arguably the most accurate and valid transformation between GCS WGS 1984 (normally used by GPS) and British National Grid.  This article will show how to implement this transformation in ArcGIS Runtime SDK for WPF 10.1.1.

In order to use the OSGB_1936_To_WGS_1984_7 (urn:ogc:def:coordinateOperation:EPSG::5339) transformation add the same “uk” folder as described in the previous article to the ArcGIS SDKs installation, both for LocalServer32 and LocalServer64. For example:

 ..\ArcGIS SDKs\WPF10.1.1\arcgisruntime10.1.1\LocalServer64\pedata\ntv2\uk

Once installed the DatumTransform code 5339 will return the OSTN02 NTv2 transformation, as shown in the following code sample. 

 

private void MyMap_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)

{

   if ((MyMap.Extent != null) && (LocalServer.IsRunning))

   {

      System.Windows.Point screenPoint = e.GetPosition(MyMap);

      ESRI.ArcGIS.Client.Geometry.MapPoint mapPoint = MyMap.ScreenToMap(screenPoint);

      if (MyMap.WrapAroundIsActive)

      {

   mapPoint = ESRI.ArcGIS.Client.Geometry.Geometry.NormalizeCentralMeridian(mapPoint)

                        as ESRI.ArcGIS.Client.Geometry.MapPoint;

      }

      MapCoordsTextBlock.Text = string.Format(“BNG Map Coords: X = {0}, Y = {1}”, Math.Round(mapPoint.X, 4), Math.Round(mapPoint.Y, 4));

      BNGTextBlock.Text = string.Format(“BNG Bigram Coords: {0}”, BNGBiGram(mapPoint.X,mapPoint.Y));

      DatumTransform useOSTN02NTv2 = new DatumTransform((int)5339);

      SpatialReference m_WGS84 = new SpatialReference((int)4326);

      _geometryService.Project(new List<Graphic>() { new Graphic() { Geometry = mapPoint } }, m_WGS84, useOSTN02NTv2, true);

      mapPoint = _geometryService.ProjectLastResult[0].Geometry as ESRI.ArcGIS.Client.Geometry.MapPoint;

      LatLongCoordsTextBlock.Text = string.Format(“WGS 1984 Coords: Lat = {0}, Long = {1}”Math.Round(mapPoint.Y, 7), Math.Round(mapPoint.X, 7));

      }

}

This code sample outputs coordinate information to a text box:

  

Once the NTv2 files are installed in the SDK using the ArcGIS Runtime Deployment Builder to create a deployable package and selecting “Additional Projection Engine Transformations” then the “uk” folder with the OSTN02 NTv2 files is added automatically to the deployment package.

 

Jim Sibbald

 

Retired