How to create a custom vertical coordinate system


Summary This article demonstrates two methods to define custom vertical coordinate systems (VCS).

Creating a custom vertical coordinate system

The ISpatialReferenceFactory interface allows you to create the Datum, VerticalDatum, and LinearUnit component parts. These components can also be created using a similar Define method available on their classes. The first sample creates a gravity-related VCS that uses a vertical datum, while the second example creates an ellipsoid-based vertical coordinate system. See the following code example:
[Java]
static IVerticalCoordinateSystem createVerticalCoordinateSystem()throws Exception{
    //Creates a gravity-related vertical coordinate system.
    //Create the SpatialReferenceFactory to access existing component parts.
    ISpatialReferenceFactory3 spatialReferenceFactory = new
        SpatialReferenceEnvironment();

    IVerticalDatum verticalDatum = spatialReferenceFactory.createVerticalDatum((int)
        esriSRVerticalDatumType.esriSRVertDatum_Taranaki);

    //Because a VCS can be based upon Datum or VerticalDatum, IHVDatum is used 
    //when defining a vertical coordinate system.
    IHVDatum hvDatum = (IHVDatum)verticalDatum;
    ILinearUnit linearUnit = (ILinearUnit)spatialReferenceFactory.createUnit((int)
        esriSRUnitType.esriSRUnit_Meter);

    //The direction is set to -1 and the VerticalShift is set to 40.
    IVerticalCoordinateSystemEdit verticalCoordinateSystemEdit = new
        VerticalCoordinateSystem();
    Object name = "New VCoordinateSystem";
    Object alias = "VCoordinateSystem alias";
    Object abbreviation = "abbr";
    Object remarks = "Test for options";
    Object usage = "New Zealand";
    Object hvDatumObject = hvDatum;
    Object unitObject = linearUnit;
    Object verticalShift = 40;
    Object positiveDirection =  - 1;

    verticalCoordinateSystemEdit.define(name, alias, abbreviation, remarks, usage,
        hvDatumObject, unitObject, verticalShift, positiveDirection);

    IVerticalCoordinateSystem verticalCoordinateSystem = (IVerticalCoordinateSystem)
        verticalCoordinateSystemEdit;

    return verticalCoordinateSystem;
}
[Java]
static IVerticalCoordinateSystem createEllipsoidBasedVerticalCoordinateSystem()
    throws Exception{
    //Creates an ellipsoid-based vertical coordinate system.
    //Create the SpatialReferenceFactory to access existing component parts.
    ISpatialReferenceFactory3 spatialReferenceFactory = new
        SpatialReferenceEnvironment();
    IDatum datum = spatialReferenceFactory.createDatum((int)
        esriSRDatumType.esriSRDatum_WGS1984);

    //Because a VCS can be based upon Datum or VerticalDatum, IHVDatum is used 
    //when defining a vertical coordinate system.
    IHVDatum hvDatum = (IHVDatum)datum;
    ILinearUnit linearUnit = (ILinearUnit)spatialReferenceFactory.createUnit((int)
        esriSRUnitType.esriSRUnit_Foot);

    //Direction is again positive down, while the vertical shift is 0.4839.
    IVerticalCoordinateSystemEdit verticalCoordinateSystemEdit = new
        VerticalCoordinateSystem();
    Object name = "WGS84 vcs";
    Object alias = "WGS84 ellipsoid";
    Object abbreviation = "w84 3d";
    Object remarks = "WGS84 ell-based vcs";
    Object usage = "everywhere!";
    Object hvDatumObject = hvDatum;
    Object unitObject = linearUnit;
    Object verticalShift = 0.4839;
    Object positiveDirection =  - 1;

    verticalCoordinateSystemEdit.define(name, alias, abbreviation, remarks, usage,
        hvDatumObject, unitObject, verticalShift, positiveDirection);
    IVerticalCoordinateSystem verticalCoordinateSystem = (IVerticalCoordinateSystem)
        verticalCoordinateSystemEdit;

    return verticalCoordinateSystem;
}


See Also:

How to create a predefined vertical coordinate system




Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime