ArcGIS Explorer Component Help |
GeometryOperations..::.Project Method (Geometry, CoordinateSystem) |
GeometryOperations Class Example See Also |
Assembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static Geometry Project( Geometry inputGeometry, CoordinateSystem newCoordinateSystem ) |
Visual Basic (Declaration) |
---|
Public Shared Function Project ( _ inputGeometry As Geometry, _ newCoordinateSystem As CoordinateSystem _ ) As Geometry |
Parameters
- inputGeometry
- Type: ESRI.ArcGISExplorer.Geometry..::.Geometry
A Geometry to copy and project.
- newCoordinateSystem
- Type: ESRI.ArcGISExplorer.Geometry..::.CoordinateSystem
The coordinate system to project to.
Return Value
A new Geometry of the same type as the inputGeometry, projected to the newCoordinateSystem.Remarks
Each Geometry has a specific CoordinateSystem which relates the coordinates of the geometry to locations on the earth. You can change a geometry to use a different CoordinateSystem by projecting it. All geometries drawn on the MapDisplay in ArcGIS Explorer automatically draw using the coordinate system of the display - this includes the geometries which are used to draw Graphics and all types of MapItem - you do not need to add any code for these items to be projected correctly.
However, if you wish to interact with other systems which require location or geometry input or output in a specific coordinate system, you can use the Project method in order to perform this work.
The ArcGIS Explorer application maintains a collection of GeographicTransformations in the GeographicTransformations2D and GeographicTransformations3D properties. Adding a GeographicTransformation to these collection ensures it will be used in a call to Project, and would also be used internally to project any layers or graphics on-the-fly, if those objects have an appropriate coordinate system pair. The collection used depends on whether the current DisplayMode is 2D or 3D. You can use the alternative Project(Geometry, CoordinateSystem, GeographicTransformation) overload in order to perform the projection using a specific GeographicTransformation.
Examples
// Create a Point at Greenwich, UK. By default new Geometries have the WGS 1984 geographical coordinate system. ESRI.ArcGISExplorer.Geometry.Point geographicalGreenwich = new ESRI.ArcGISExplorer.Geometry.Point(0, 51.4791); // Create the destination coordinate system, British National Grid, and project the point to this system. CoordinateSystem projected = CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid; ESRI.ArcGISExplorer.Geometry.Point projectedGreenwich = GeometryOperations.Project(geographicalGreenwich as Geometry, projected) as ESRI.ArcGISExplorer.Geometry.Point;
' Create a Point at Greenwich, UK. By default new Geometries have the WGS 1984 geographical coordinate system. Dim geographicalGreenwich As ESRI.ArcGISExplorer.Geometry.Point = New ESRI.ArcGISExplorer.Geometry.Point(0, 51.4791) ' Create the destination coordinate system, British National Grid, and project the point to this system. Dim projected As CoordinateSystem = CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid Dim projectedGreenwich As ESRI.ArcGISExplorer.Geometry.Point = GeometryOperations.Project(geographicalGreenwich, projected)