Creating a predefined vertical coordinate system
The ISpatialReferenceFactory3 interface provides access for creating a series of predefined vertical coordinate systems (VCS) available in ArcGIS. Similar to other coordinate system types, a list of VCS can be returned using ISpatialReferenceFactory3.CreatePredefinedVerticalCoordinateSystems.
See the following code example:
[Java]
static void getVCSList()throws Exception{
//set up the SpatialReferenceEnvironment
ISpatialReferenceFactory srFact = new SpatialReferenceEnvironment();
ISpatialReferenceFactory3 srFact3 = (ISpatialReferenceFactory3)srFact;
ISet vcsSet = srFact3.createPredefinedVerticalCoordinateSystems();
vcsSet.reset();
IVerticalCoordinateSystem vcs;
for (int i = 0; i < vcsSet.getCount(); i++){
vcs = (IVerticalCoordinateSystem)vcsSet.next();
System.out.println("VCS Name: " + vcs.getName() + " (Code: " +
vcs.getFactoryCode() + ")");
}
}
The list of predefined vertical datums can also be accessed using a similar method of ISpatialReferenceFactory3.CreatePredefinedVerticalCoordinateSystems. The following code example retrieves the list of vertical datums defined by ArcGIS. This method is useful when populating a control with all the available VCS definitions.
[Java]
static void getVerticalDatumList()throws Exception{
//set up the SpatialReferenceEnvironment
ISpatialReferenceFactory srFact = new SpatialReferenceEnvironment();
ISpatialReferenceFactory3 srFact3 = (ISpatialReferenceFactory3)srFact;
ISet vDatumSet = srFact3.createPredefinedVerticalDatums();
vDatumSet.reset();
IVerticalDatum vDatum;
for (int i = 0; i < vDatumSet.getCount(); i++){
vDatum = (IVerticalDatum)vDatumSet.next();
System.out.println("VDatum Name: " + vDatum.getName() + " (Code: " +
vDatum.getFactoryCode() + ")");
}
}
If you already know the VCS or vertical datum you are interested in working with, use ISpatialReferenceFactory3.CreateVerticalCoordinateSystem or ISpatialReferenceFactory3.CreateVerticalDatum and pass in the appropriate factory code. See the following code example:
[Java]
static void createVerticalReferenceSystem()throws Exception{
//Set up the SpatialReferenceEnvironment
ISpatialReferenceFactory3 spatialReferenceFactory3 = new
SpatialReferenceEnvironment();
// Dimension a vertical datum and vertical coordinate system
// Use the enumerations to create instances of the predefined objects
IVerticalDatum verticalDatum = spatialReferenceFactory3.createVerticalDatum((int)
esriSRVerticalDatumType.esriSRVertDatum_Alicante);
IVerticalCoordinateSystem verticalCoordinateSystem =
spatialReferenceFactory3.createVerticalCoordinateSystem((int)
esriSRVerticalCSType.esriSRVertCS_Alicante);
}
See Also:
How to create a custom vertical coordinate systemDevelopment licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |