ポリラインを作成して投影変換し距離を測定

private void Button_Click(object sender, RoutedEventArgs e)
{
    //ポリラインの作成
    //http://help.arcgis.com/en/webapi/wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Graphic.html

    //空間参照
    ESRI.ArcGIS.Client.Geometry.SpatialReference aSpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(3857);    //WebMercator
    ESRI.ArcGIS.Client.Geometry.SpatialReference aSpatialReferenceWGS84 = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4326); //WGS84

    //WebMercator(東京駅→大阪駅)
    ESRI.ArcGIS.Client.Geometry.MapPoint aMapPoint1 = new ESRI.ArcGIS.Client.Geometry.MapPoint(15558809.770, 4256814.876, aSpatialReference);
    ESRI.ArcGIS.Client.Geometry.MapPoint aMapPoint2 = new ESRI.ArcGIS.Client.Geometry.MapPoint(15083276.889, 4123494.890, aSpatialReference);

    //GCS_WGS84(東京駅→大阪駅)
    //ESRI.ArcGIS.Client.Geometry.MapPoint aMapPoint1 = new ESRI.ArcGIS.Client.Geometry.MapPoint(135.495375,  34.702318, aSpatialReference);
    //ESRI.ArcGIS.Client.Geometry.MapPoint aMapPoint2 = new ESRI.ArcGIS.Client.Geometry.MapPoint(139.767201,  35.681211, aSpatialReference);


    //ポイント コレクション
    ESRI.ArcGIS.Client.Geometry.PointCollection aPointCollection = new ESRI.ArcGIS.Client.Geometry.PointCollection();
    //aPointCollection.Add(aMapPoint1);
    //aPointCollection.Add(aMapPoint2);
    aPointCollection.Add(aMapPoint1);
    aPointCollection.Add(aMapPoint2);

    //パート
    System.Collections.ObjectModel.ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection> anObservableCollection = new System.Collections.ObjectModel.ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection>();
    anObservableCollection.Add(aPointCollection);

    //ポリライン
    ESRI.ArcGIS.Client.Geometry.Polyline aPolyline = new ESRI.ArcGIS.Client.Geometry.Polyline();
    aPolyline.Paths = anObservableCollection;
    aPolyline.SpatialReference = aSpatialReference;



    //ジオメトリ サービスによる投影変換

    //ローカル ジオメトリ サーバー
    ESRI.ArcGIS.Client.Local.LocalGeometryService lgs = ESRI.ArcGIS.Client.Local.LocalGeometryService.GetService();
    ESRI.ArcGIS.Client.Tasks.GeometryService gs = new ESRI.ArcGIS.Client.Tasks.GeometryService(lgs.UrlGeometryService);

    //グラフィックの作成
    //http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html
    ESRI.ArcGIS.Client.Graphic aGraphic = new ESRI.ArcGIS.Client.Graphic() { Geometry = aPolyline };
    //ESRI.ArcGIS.Client.Graphic aGraphic = new ESRI.ArcGIS.Client.Graphic();
    //aGraphic.Geometry = (ESRI.ArcGIS.Client.Geometry.Geometry)aPolyline;

    //グラフィックのシンボル
    //ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol aSimpleLineSymbol = new ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol();
    //aSimpleLineSymbol.Color = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
    //aSimpleLineSymbol.Style = ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol.LineStyle.Solid;
    //aSimpleLineSymbol.Width = 7;
    //aGraphic.Symbol = (ESRI.ArcGIS.Client.Symbols.Symbol)aSimpleLineSymbol;

    //System.Collections.Generic.List<ESRI.ArcGIS.Client.Graphic> oldGraphics = new System.Collections.Generic.List<ESRI.ArcGIS.Client.Graphic>() { new ESRI.ArcGIS.Client.Graphic() { Geometry = aPolyline } };
    System.Collections.Generic.List<ESRI.ArcGIS.Client.Graphic> oldGraphics = new System.Collections.Generic.List<ESRI.ArcGIS.Client.Graphic>();
    oldGraphics.Add(aGraphic);
    
    //グラフィックの投影変換
    System.Collections.Generic.IList<ESRI.ArcGIS.Client.Graphic> newGraphics = gs.Project(oldGraphics, aSpatialReferenceWGS84);

    
    double lengthE = ESRI.ArcGIS.Client.Geometry.Euclidian.Length(aPolyline);   //ユークリッド距離
    double lengthG = ESRI.ArcGIS.Client.Geometry.Geodesic.Length(newGraphics[0].Geometry as ESRI.ArcGIS.Client.Geometry.Polyline);  //大圏距離

    MessageBox.Show(lengthE.ToString() + "\n" + lengthG.ToString());

}