当前位置:文档之家› ArcGIS中的投影和坐标转换

ArcGIS中的投影和坐标转换

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

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

操作方法:运行ArcGIS9中的ArcMap,打开ArcToolBox,打开Data Management Tools->Projections and Transformations->Define Projection 项打开坐标定义对话框。

介下来在Input DataSet or Feature Class栏中输入或点击旁边的按钮选择相应的DataSet或Feature Class;在Coordinate System栏中输入或点击旁边的按钮选择需要为上述DataSet或Feature定义的坐标系统。

最后点OK键即可。

例如某点状shape文件中某点P的坐标为X 112.2 Y 43.3 ,且该shape文件没有带有相应的Prj文件,即没有空间参考信息,也不知道X Y 的单位。

通过坐标系统定义的操作定义其为Beijing1954坐标,那么点P的信息是东经112.2度北纬43.3度。

2 ArcGIS中的投影方法投影的方法可以使带某种坐标信息数据源进行向另一坐标系统做转换,并对源数据中的X和Y 值进行修改。

我们生产实践中一个典型的例子是利用该方法修正某些旧地图数据中X,Y值前加了带数和分带方法的数值。

操作方法:运行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键即可。

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

3 编程实现坐标转换和投影3.1 矢量数据投影和坐标转换相关接口3.1.1 IGeometry.Project方法该方法声明如下: (C#语法)public void Project (ISpatialReference newReferenceSystem);该方法对实现Igeoemtry的对象进行投影操作, 参数为目标空间参考.以下代码中实现了对Point 对象从一个空间参考到另一个空间参考的投影操作://Create Spatial Reference FactoryISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();ISpatialReference sr1;//GCS to project fromIGeographicCoordinateSystem gcs =srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_NAD1983 );sr1 = gcs;sr1.SetFalseOriginAndUnits(-180, -90, 1000000);//Projected Coordinate System to project intoIProjectedCoordinateSystem pcs =srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD198 3N_AmericaLambert);pcs.SetFalseOriginAndUnits(0, 0, 1000);ISpatialReference sr2;sr2 = pcs;//Point to projectIPoint point = new PointClass() as IPoint;point.PutCoords(-117.17, 34.06);//Geometry Interface to do actual projectIGeometry geometry;geometry = point;geometry.SpatialReference = sr1;geometry.Project(sr2);point = geometry as IPoint;double x;double y;point.QueryCoords(out x, out y);Debug.Print("X: " + x.ToString());Debug.Print("Y: " + y.ToString());IGeometry接口的Project方法提供的投影操作实现了最基本的坐标转换功能. 实际数据处理过程中, 比较明确数据转换前后空间参考信息情况下一般用此方法作坐标转换,不同投影带之间的坐标转换就是一个典型.3.1.2 ITransform2D接口ITransform2D接口不仅提供了图形平移, 旋转和缩放,还提供了更加强大的坐标转换方法Transform. 其定义如下:(C#语法)public void Transform (esriTransformDirection direction,ITransformation transformation);在该方法中, 参数direction是转换方向, transformation是一个Itransformation接口, 而Itransformation接口由很多类实现,这意味着不同的实现类,所包含的坐标转换数学公式是不一的, 这里面包括二次多项式转换(AffineTransformation2D), AbridgedMolodensky转换(AbridgedMolodenskyTransformation)等。

每一种实现类的转换方法这里不再赘述,可参照ArcObjects联机帮助获得更详细的信息,下面举例来说明该方法的使用:(Delphi 代码)procedure Transform_(FromPtColl, ToPtColl: IPointCollection; pGeo as IGeometry); varpAffineTransformation2D: IAffineTransformation2D;ControlPtCnt: integer;FormPtArray: array of IPoint;ToPtArray: array of IPoint;i: integer;pTransform2D: ITransform2D;begin//判断给定的控制点是否合法if FromPtColl.PointCount <> ToPtColl.PointCount thenbegin//控制点不成对错误exit;end;if FromPtColl.PointCount < 4 thenbegin//控制点不能少于4个exit;end;ControlPtCnt := FromPtColl.PointCount;SetLength(FormPtArray, ControlPtCnt);SetLength(ToPtArray, ControlPtCnt);for i := 0 to ControlPtCnt -1 dobeginFormPtArray[i] := CoPoint.Create as IPoint;FormPtArray[i].PutCoords(FromPtColl.Point[i].X, FromPtColl.Point[i].Y);ToPtArray[i] := CoPoint.Create as IPoint;ToPtArray[i].PutCoords(ToPtColl.Point[i].X, ToPtColl.Point[i].Y);end;//创建 AffineTransformation2D 对象pAffineTransformation2D := CoAffineTransformation2D.Create as IAffineTransformation2D;//设置控制点信息pAffineTransformation2D.DefineFromControlPoints(ControlPtCnt, FormPtArray[0], ToPtArray[0]);//转到ITransform2D接口pTransform2D := pGeo as ITransform2D;//坐标转换pTransform2d.Transform(esriTransformForward, pAffineTransformation2D);end;ITransform接口较Igeoemtry提供了更加丰富的坐标转换方法。

3.2 影像数据纠正。

影像数据纠正可以通过IrasterGeometryProc接口实现。

该接口提供了影像Clip, Filp, Merge, Mirror 以及Mosaic等操作。

如果通过控制点的方式对影像进行纠正处理可以通过该接口的wrap方法。

相关主题