arcgis 投影变换与坐标转换研究

arcgis 投影变换与坐标转换研究

1 ArcGIS中的投影方法

投影的方法可以使带某种坐标信息数据源进行向另一坐标系统做转换,并对源数据中的X和Y值进行修改。我们生产实践中一个典型的例子是利用该方法修正某些旧地图数据中X,Y值前加了带数和分带方法的数值。 字串9

操作方法:运行ArcGIS9中的ArcMap,打开ArcToolBox,打开 Data Management Tools ->Projections and Transformations->Feature->Project 项 打开投影对话框。在Input DataSet or Feature Class栏中输入或点击旁边的按钮选择相应的DataSet或Feature Class(带有空间参考),Output DataSet or Feature Class栏中输入或点击旁边的按钮选择目标DataSet或Feature Class,在Output Coordinate System 栏中输入或点击旁边的按钮选择目标数据的坐标系统。最后点OK键即可。 字串3

例如 某点状shape文件中 某点P的坐标为  X 40705012  Y 3478021 ,且该shape文件坐标系统为中央为东经120度的高斯克吕格投影,在数据使用过程中为了将点P的值改为真实值X 705012  Y478021,首先将源数据的投影参数中False_Easting和False_Northing值分别加上40000000和3000000作为源坐标系统,修改参数前的坐标系统作为投影操作的目标坐标系统,然后通过投影操作后生成一新的Shape文件,且与源文件中点P对应的点的坐标为X 705012  Y478021。

字串2

2 ArcGIS中坐标系统的定义

一般情况下地理数据库(如Personal GeoDatabase的 Feature DataSet 、Shape File等)在创建时都具有空间参考的属性,空间参考定义了该数据集的地理坐标系统或投影坐标系统,没有坐标系统的地理数据在生产应用过程中是毫无意义的,但由于在数据格式转换、转库过程中可能造成坐标系统信息丢失,或创建数据库时忽略了坐标系统的定义,因此需要对没有坐标系统信息的数据集进行坐标系统定义。 字串7

坐标系统的定义是在不改变当前数据集中特征X Y值的情况下 对该数据集指定坐标系统信息。

字串2

操作方法:运行ArcGIS9中的ArcMap,打开ArcToolBox,打开 Data Management Tools ->Projections and Transformations->Define Projection 项 打开坐标定义对话框。介下来在Input DataSet or Feature Class栏中输入或点击旁边的按钮选择相应的DataSet或Feature Class;在Coordinate System栏中输入或点击旁边的按钮选择需要为上述DataSet或Feature定义的坐标系统。最后点OK键即可。

字串8

例如 某点状shape文件中 某点P的坐标为  X 112.2  Y 43.3 ,且该shape文件没有带有相应的Prj文件,即没有空间参考信息,也不知道X Y 的单位。通过坐标系统定义的操作定义其为Beijing1954坐标,那么点P的信息是东经112.2度 北纬43.3度。

字串6

3  编程实现坐标转换和投影

3.1 矢量数据投影和坐标转换

相关接口 字串4

3.1.1 IGeometry.Project方法 字串4

该方法声明如下 字串1

public void Project (

字串1

    ISpatialReference newReferenceSystem 字串7

); 字串1

该方法对实现Igeoemtry的对象进行投影操作, 参数为目标空间参考.以下代码中实现了对Point对象从一个空间参考到另一个空间参考的投影操作:

字串1

//Create Spatial Reference Factory 字串1

            ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass(); 字串3

            ISpatialReference sr1;

字串9

            //GCS to project from 字串8

            IGeographicCoordinateSystem gcs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_NAD1983); 字串2

            sr1 = gcs;

字串4

            sr1.SetFalseOriginAndUnits(-180, -90, 1000000); 字串7

            //Projected Coordinate System to project into

字串9

            IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983N_AmericaLambert);

字串6

            pcs.SetFalseOriginAndUnits(0, 0, 1000);

字串8

            ISpatialReference sr2; 字串6

            sr2 = pcs; 字串6

            //Point to project 字串4

            IPoint point = new PointClass() as IPoint; 字串2

            point.PutCoords(-117.17, 34.06); 字串1

            //Geometry Interface to do actual project 字串5

            IGeometry geometry;

字串7

            geometry = point; 字串5

            geometry.SpatialReference = sr1;

字串4

            geometry.Project(sr2);

字串5

            point = geometry as IPoint;

字串4

            double x;

字串8

            double y; 字串3

            point.QueryCoords(out x, out y);

字串8

            Debug.Print("X: " + x.ToString());

字串9

            Debug.Print("Y: " + y.ToString()); 字串9

IGeometry接口的Project方法提供的投影操作实现了最基本的坐标转换功能. 实际数据处理过程中, 比较明确数据转换前后空间参考信息情况下一般用此方法作坐标转换,不同投影带之间的坐标转换就是一个典型.

字串5

3.1.2 ITransform2D接口

ITransform2D接口不仅提供了图形平移, 旋转和缩放,还提供了更加强大的坐标转换方法Transform. 其定义如下:(C#语法) 字串3

public void Transform (

字串5

    esriTransformDirection direction,

字串9

    ITransformation transformation 字串5

); 字串4

在该方法中, 参数direction是转换方向, transformation是一个Itransformation接口, 而Itransformation接口由很多类实现,这意味着不同的实现类,所包含的坐标转换数学公式是不一的, 这里面包括二次多项式转换(AffineTransformation2D), AbridgedMolodensky转换(AbridgedMolodenskyTransformation)等。每一种实现类的转换方法这里不再赘述,可参照ArcObjects联机帮助获得更详细的信息,下面举例来说明该方法的使用:(Delphi 代码)

字串6

procedure Transform_(FromPtColl, ToPtColl: IPointCollection; pGeo as IGeometry);

字串9

var

字串2

  pAffineTransformation2D: IAffineTransformation2D;

字串9

  ControlPtCnt: integer;

字串4

  FormPtArray: array of IPoint; 字串3

  ToPtArray: array of IPoint;

字串1

  i: integer;  字串5

  pTransform2D: ITransform2D;

字串7

begin 字串3

  //判断给定的控制点是否合法 字串9

  if FromPtColl.PointCount <> ToPtColl.PointCount then

字串9

    begin 字串9

      //控制点不成对错误 字串5

      exit; 字串7

    end;

字串6

  if FromPtColl.PointCount < 4 then 字串6

    begin

字串8

      //控制点不能少于4个 字串9

      exit; 字串3

    end; 字串9

  ControlPtCnt := FromPtColl.PointCount;

字串3

  SetLength(FormPtArray, ControlPtCnt); 字串3

  SetLength(ToPtArray, ControlPtCnt);

字串3

  for i := 0 to ControlPtCnt -1 do

字串1

    begin 字串6

      FormPtArray[i] := CoPoint.Create as IPoint; 字串3

      FormPtArray[i].PutCoords(FromPtColl.Point[i].X,  FromPtColl.Point[i].Y);

字串4

      ToPtArray[i] := CoPoint.Create as IPoint; 字串7

      ToPtArray[i].PutCoords(ToPtColl.Point[i].X,  ToPtColl.Point[i].Y); 字串6

    end; 字串9

  //创建  AffineTransformation2D 对象

字串7

  pAffineTransformation2D := CoAffineTransformation2D.Create as IAffineTransformation2D;  字串9

  //设置控制点信息 字串8

  pAffineTransformation2D.DefineFromControlPoints(ControlPtCnt, FormPtArray[0], ToPtArray[0]); 

字串4

  //转到ITransform2D接口

字串6

 pTransform2D := pGeo as ITransform2D;

字串2

  //坐标转换

字串1

  pTransform2d.Transform(esriTransformForward, pAffineTransformation2D); 字串2

end;

字串9

 

字串1

ITransform接口较Igeoemtry提供了更加丰富的坐标转换方法。

字串2

3.2 影像数据纠正。

影像数据纠正可以通过IrasterGeometryProc接口实现。该接口提供了影像Clip, Filp, Merge, Mirror以及Mosaic等操作。如果通过控制点的方式对影像进行纠正处理可以通过该接口的wrap方法。该方法声明如下:(C#语法)

字串5

public void Warp ( 字串8

    IPointCollection sourceControlPoints,

字串9

    IPointCollection targetControlPoints, 字串2

    esriGeoTransTypeEnum transformType,

字串5

    IRaster ipRaster

字串9

);

字串5

参数 sourceControlPoints和targetControlPoint定义了控制点信息, transformType定义了坐标转换方法, ipRaster是需要转换的Raster对象. 以下代码是该接口使用的例子:

字串7

public static void GeoreferenceRaster(IRasterDataset2 rasterDataset, IPointCollection sourcePoints, IPointCollection targetPoints)

字串5

{ 字串1

  //this sample show how to georeference a raster using control points 字串7

  // sourcePoints: represents source control points

字串9

  // targetPoints: represents target control points  IRasterGeometryProc rasterPropc = new RasterGeometryProcClass(); 字串9

  IRaster raster = rasterDataset.CreateDefaultRaster();  //set the transformatin 字串3

  rasterPropc.Warp(sourcePoints, targetPoints, esriGeoTransTypeEnum.esriGeoTransPolyOrder1, raster);  //There are two ways to get the georeferenced result: to save the transformation with the input raster dataset 字串5

  rasterPropc.Register(raster);  //or save to another new raster dataset

字串7

  rasterPropc.Rectify(@"c:\temp\georeferencing_output.img", "IMAGINE Image", raster); 字串3

} 字串3

需要注意的是当选择不同的转换类型时(参数transformType取值不同时), 对控制点的对数也有不同的要求. 这个可以参照联机帮助中的详细说明. 字串3

此外, 使用IrasterGeometryProc.Wrap方法, 会略微改变影像图的色彩值, 当对一幅影像图前后转换作对比时会发现这种色彩的变化情况. 字串4

个人认为,ArcGIS对影像图的处理功能较其他一些专业影像处理软件来讲,还是稍显逊色了些. 字串9

posted @ 2008-08-20 20:54  zhh  阅读(728)  评论(0编辑  收藏  举报