Interface ISpatialReferenceFactory3
Provides access to members that create vertical datums or coordinate systems.
[Guid("59025A77-2CF9-4EF6-992A-1EA18F0012F0")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISpatialReferenceFactory3 : ISpatialReferenceFactory2, ISpatialReferenceFactory
Remarks
The ISpatialReferenceFactory3 interface has two methods that are useful when working with low and high precision spatial references. ConstructHighPrecisionSpatialReference creates a high precision spatial reference from a low precision spatial reference. Using this method will ensure that coordinate values will fit exactly into the new, denser grid mesh. Each intersection of the original grid is an intersection of the new grid. ConstructLowPrecisionSpatialReference will create a low precision spatial reference from an existing high precision one. You can require that the new resolution value be maintained, usually at the expense of the XY domain extent.
When using this interface in a console application, you must mark the routine as single-threaded. A class can be marked as single-threaded by adding the [STAThread] attribute immediately preceding your routine's declaration.
Example:
[STAThread]static void Main(string[] args)
{
}
When using this interface in a console application, you must mark the routine as single-threaded. A class can be marked as single-threaded by adding the [STAThread] attribute immediately preceding your routine's declaration.
<STAThread()> _
Shared Sub Main(ByVal args As String())
End Sub
Properties
GeoTransformationDefaults
IGeoTransformationOperationSet GeoTransformationDefaults { get; }
Property Value
Methods
ConstructHighPrecisionSpatialReference(ISpatialReference, int, int, int)
Constructs a high precision spatial reference based on an existing spatial reference. xy/z/mDoubler is the number of times the respective precision is to be doubled. A value of zero will find the maximum doubling for that precision.
ISpatialReference ConstructHighPrecisionSpatialReference(ISpatialReference inSR, int xyDoubler, int zDoubler, int mDoubler)
Parameters
inSRISpatialReferencexyDoublerintzDoublerintmDoublerint
Returns
Remarks
ConstructHighPrecisionSpatialReference creates a high precision copy of an existing low precision spatial reference. It is used when the new high precision spatial reference grid must “mesh” with the existing low precision grid. Each point of the old grid is also a point of the new grid.
The doubler parameters are exponents of powers of 2. For example, if the xyDoubler = 2, then the XY grid resolution of the output spatial reference is 4 times the input grid resolution (16 new grid cells cover 1 old grid cell). The grid also is translated so it remains centered about its current location. If a doubler parameter is -1, then the closest legal resolution to the default that covers the input XY domain and the coordinate system's horizon is chosen. If the doubler parameter is -2, the smallest possible legal resolution that covers the input XY domain and the coordinate system's horizon is chosen. In these cases, the highest exponent is chosen that will produce an output grid that both contains all the grid points defined by the input grid and covers the horizon of the input spatial reference. A doubler value of zero will maintain the existing resolution of the low precision spatial reference. It is an error to specify a doubler parameter that will result in a grid smaller than the corresponding input grid.
For ProjectedCoordinateSystems or GeographicCoordinateSystems the minimum values of the domain extent are defined just outside the envelope defined by the coordinate system's horizon.
private void ConstructHighPrecisionSpatialReference()
{
// use activator class with SpatialReferenceEnvironment singleton
Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
System.Object obj = Activator.CreateInstance(factoryType);
ISpatialReferenceFactory3 spatialReferenceFactory = obj as ISpatialReferenceFactory3;
ISpatialReference lowSpatialReference = spatialReferenceFactory.CreateSpatialReference(4326);
IControlPrecision2 controlPrecision = lowSpatialReference as IControlPrecision2;
//creates a low-precision SR
controlPrecision.IsHighPrecision = false;
ISpatialReferenceResolution spatialReferenceResolution = lowSpatialReference as ISpatialReferenceResolution;
lowSpatialReference.SetFalseOriginAndUnits(-85, 120, 100000);
//XYDoubler = -1 will result in highest legal resolution
//M and Z doubler = 0 will result in output high precision SR matching resolution of input SR
ISpatialReference highSpatialReference = spatialReferenceFactory.ConstructHighPrecisionSpatialReference(lowSpatialReference, -1, 0, 0);
}
ConstructLowPrecisionSpatialReference(bool, ISpatialReference, IEnvelope)
Construct a low precision spatial reference with the same scale factor as the high precision input, but with a different domain extent. If the calculated domain extent cannot cover the specified data extent, an error is returned.
ISpatialReference ConstructLowPrecisionSpatialReference(bool bMatchPrecision, ISpatialReference inSR, IEnvelope dataExtent)
Parameters
bMatchPrecisionboolinSRISpatialReferencedataExtentIEnvelope
Returns
Remarks
ConstructLowPrecisionSpatialReference creates a low precision copy of an existing high precision spatial reference.
- bMatchPrecision indicates whether the output low precision spatial reference should have the same resolution as the input high precision spatial reference. If not, then pExtent is used to help determine the output resolution.
- pInSR is the existing high precision spatial reference. Passing in a low precision spatial reference will return an error.
- pExtent is used to determine the output resolution
when matching the input resolultion is not desired.
ConstructLowPrecisionSpatialReference delegates to the existing
method
IGeometryEnvironment::ConstructDomainExtent in that
case, which attempts to enlarge the extent by a factor of 1.5
(clipped against the horizon extent). If an empty envelope is
passed in and bMatchPrecision is FALSE, then the low precision
version of
ISpatialReferenceResolution::ConstructFromHorizon is
used for GeographicCoordinateSystems or ProjectedCoordinateSystems.
If bMatchPrecision is true, then an attempt is made to use the
domain extent as the new domain extent; the precision is
not matched in this case.
CreateDatum(int)
IDatum CreateDatum(int datumType)
Parameters
datumTypeint
Returns
CreateESRISpatialReference(string, out ISpatialReference, out int)
void CreateESRISpatialReference(string spatRefInfo, out ISpatialReference SpatialReference, out int cBytesRead)
Parameters
spatRefInfostringSpatialReferenceISpatialReferencecBytesReadint
CreateESRISpatialReferenceFromPRJ(string)
ISpatialReference CreateESRISpatialReferenceFromPRJ(string prj)
Parameters
prjstring
Returns
CreateESRISpatialReferenceFromPRJFile(string)
ISpatialReference CreateESRISpatialReferenceFromPRJFile(string prjFile)
Parameters
prjFilestring
Returns
CreateESRISpatialReferenceInfo(string, out ISpatialReferenceInfo, out int)
Creates a spatial reference system and defines it from the specified ESRISpatialReference buffer.
void CreateESRISpatialReferenceInfo(string spatRefInfo, out ISpatialReferenceInfo SpatialReference, out int cBytesRead)
Parameters
spatRefInfostringSpatialReferenceISpatialReferenceInfocBytesReadint
CreateESRISpatialReferenceInfoFromPRJ(string)
Creates a spatial reference from a PRJ string.
ISpatialReferenceInfo CreateESRISpatialReferenceInfoFromPRJ(string prj)
Parameters
prjstring
Returns
CreateESRISpatialReferenceInfoFromPRJFile(string)
Creates a spatial reference from a PRJ file.
ISpatialReferenceInfo CreateESRISpatialReferenceInfoFromPRJFile(string prjFile)
Parameters
prjFilestring
Returns
CreateGeoTransformation(int)
ITransformation CreateGeoTransformation(int gTransformationType)
Parameters
gTransformationTypeint
Returns
CreateGeographicCoordinateSystem(int)
IGeographicCoordinateSystem CreateGeographicCoordinateSystem(int gcsType)
Parameters
gcsTypeint
Returns
CreateParameter(int)
IParameter CreateParameter(int parameterType)
Parameters
parameterTypeint
Returns
CreatePredefinedAngularUnits()
ISet CreatePredefinedAngularUnits()
Returns
CreatePredefinedDatums()
ISet CreatePredefinedDatums()
Returns
CreatePredefinedGeographicTransformations()
ISet CreatePredefinedGeographicTransformations()
Returns
CreatePredefinedLinearUnits()
ISet CreatePredefinedLinearUnits()
Returns
CreatePredefinedPrimeMeridians()
ISet CreatePredefinedPrimeMeridians()
Returns
CreatePredefinedProjections()
ISet CreatePredefinedProjections()
Returns
CreatePredefinedSpheroids()
ISet CreatePredefinedSpheroids()
Returns
CreatePredefinedVerticalCoordinateSystems()
Creates a list of predefined vertical coordinate systems.
ISet CreatePredefinedVerticalCoordinateSystems()
Returns
CreatePredefinedVerticalDatums()
Creates a list of predefined vertical datums.
ISet CreatePredefinedVerticalDatums()
Returns
CreatePrimeMeridian(int)
IPrimeMeridian CreatePrimeMeridian(int primeMeridianType)
Parameters
primeMeridianTypeint
Returns
CreateProjectedCoordinateSystem(int)
IProjectedCoordinateSystem CreateProjectedCoordinateSystem(int pcsType)
Parameters
pcsTypeint
Returns
CreateProjection(int)
IProjection CreateProjection(int projectionType)
Parameters
projectionTypeint
Returns
CreateSpatialReference(int)
ISpatialReference CreateSpatialReference(int srID)
Parameters
srIDint
Returns
CreateSpheroid(int)
ISpheroid CreateSpheroid(int spheroidType)
Parameters
spheroidTypeint
Returns
CreateUnit(int)
IUnit CreateUnit(int unitType)
Parameters
unitTypeint
Returns
CreateVerticalCoordinateSystem(int)
Creates a predefined vertical coordinate system from an enumeration or ID code.
IVerticalCoordinateSystem CreateVerticalCoordinateSystem(int vcsID)
Parameters
vcsIDint
Returns
CreateVerticalCoordinateSystemFromESRISpatialReference(string)
Creates a vertical coordinate system from its string format.
IVerticalCoordinateSystem CreateVerticalCoordinateSystemFromESRISpatialReference(string srInfo)
Parameters
srInfostring
Returns
CreateVerticalDatum(int)
Creates a predefined vertical datum from an enumeration or ID code.
IVerticalDatum CreateVerticalDatum(int vdID)
Parameters
vdIDint
Returns
ExportESRISpatialReferenceInfoToPRJFile(string, ISpatialReferenceInfo)
Exports a spatial reference to a PRJ file.
void ExportESRISpatialReferenceInfoToPRJFile(string prjFile, ISpatialReferenceInfo SpatialReference)
Parameters
prjFilestringSpatialReferenceISpatialReferenceInfo
ExportESRISpatialReferenceToPRJFile(string, ISpatialReference)
void ExportESRISpatialReferenceToPRJFile(string prjFile, ISpatialReference SpatialReference)
Parameters
prjFilestringSpatialReferenceISpatialReference
GetPredefinedGeographicTransformations()
ISet GetPredefinedGeographicTransformations()