Select to view content in your preferred language

How to create a coordinate system with a user defined datum (i.e. with dx, dy, dz)

1241
1
06-16-2010 10:45 PM
by Anonymous User
Not applicable
Original User: gershon

Hello,

I'm developing a C# application with an ESRI map engine.
One of my requirements is to enable the user to define custom Datum with 3 parameters (linear shift) to be used within some Coordinate Systems.

A small sample will be appreciated  🙂

Thanks
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: mkennedy

Hello,

I'm developing a C# application with an ESRI map engine.
One of my requirements is to enable the user to define custom Datum with 3 parameters (linear shift) to be used within some Coordinate Systems.

A small sample will be appreciated  🙂

Thanks


Hi,

It's a lot easier if you can use existing geographic coordinate systems/datums. Geographic (datum) transformations are maintained separately from the geographic coordinate systems (GCS). A pair of GCS may have many possible  transformations based on different areas of interest, accuracies, etc.

I'm including some C# code that creates a custom 7-parameter transformation. For a 3 parameter, use the GeocentricTranslation class instead.

You will likely also need to cast back to IGeoTransformation.

Melita

    // Initialize a new spatial reference environment.
    // SpatialReferenceEnvironment is a singleton object and needs to use the Activator class.

    Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
    System.Object obj = Activator.CreateInstance(factoryType);
    ISpatialReferenceFactory2 pSRF = obj as ISpatialReferenceFactory2;

    // Initialize and create the input and output coordinate systems.
    IProjectedCoordinateSystem2 pPCSin = new ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass();
    IProjectedCoordinateSystem2 pPCSout = new ESRI.ArcGIS.Geometry.ProjectedCoordinateSystemClass();
    pPCSin = (IProjectedCoordinateSystem2)pSRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Abidjan1987UTM_30N);
    pPCSout = (IProjectedCoordinateSystem2)pSRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_WGS1984UTM_30N);

    IGeographicCoordinateSystem2 pGCSto; 
    IGeographicCoordinateSystem2 pGCSfrom;

    // Retrieve the geographic coordinate systems from the
    // two projected coordinate systems
    pGCSfrom = (IGeographicCoordinateSystem2)pPCSin.GeographicCoordinateSystem;
    pGCSto = (IGeographicCoordinateSystem2)pPCSout.GeographicCoordinateSystem;
                    
    // Initialize and create an appropriate geographic transformation.
    ICoordinateFrameTransformation pCFT;
      
    pCFT = new CoordinateFrameTransformationClass();
    pCFT.PutParameters(1.234, -2.345, 658.3, 4.3829, -2.48591, 2.18943, 2.48585);
    pCFT.PutSpatialReferences(pGCSfrom,pGCSto);
    pCFT.Name = "Custom GeoTran";
0 Kudos