This document is archived and information here might be outdated.  Recommended version.


ISpatialReferenceFactory.CreatePredefinedProjections Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IS > ISpatialReferenceFactory Interface > ISpatialReferenceFactory.CreatePredefinedProjections Method
ArcGIS Developer Help

ISpatialReferenceFactory.CreatePredefinedProjections Method

Creates a list of predefined projections.

[Visual Basic .NET]
Public Function CreatePredefinedProjections ( _
) As ISet
[C#]
public ISet CreatePredefinedProjections (
);
[C++]
HRESULT CreatePredefinedProjections(
void
);

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Create a set of all predefined map projection objects.

Remarks

A Projection object encapsulates the mathematics needed to convert geographic coordinates between two different coordinate systems. A projection is a component of a projected coordinate system and is not usually used directly. Rather, a projected cooordinate system is defined and used to project cooordinates.

[C#]

//This example shows how the CreatePredefinedProjections function returns a
//set that contains all the available Projection objects. The set is iterated
//through, and the name of each Projection with the set is obtained. These
//type of functions are useful for developers who may wish to populate a
//pulldown selection list of available SpatialReference objects. private void PrintProjections() { ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); ISet projectionSet = spatialReferenceFactory.CreatePredefinedProjections(); System.Windows.Forms.MessageBox.Show("Number of projections = " + projectionSet.Count); for (int i = 0; i < projectionSet.Count; i++) { IProjection projection = projectionSet.Next() as IProjection; System.Windows.Forms.MessageBox.Show(projection.Name); } }
[Visual Basic .NET]

'This example shows how the CreatePredefinedProjections function returns a

'set that contains all the available Projection objects. The set is iterated

'through, and the name of each Projection with the set is obtained. These 

'type of functions are useful for developers who may wish to populate a

'pulldown selection list of available SpatialReference objects.

        Dim pProjection As ESRI.ArcGIS.Geometry.IProjection
        Dim pProjectionSet As ESRI.ArcGIS.esriSystem.ISet
        Dim pSpatialRefFact As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory
        pSpatialRefFact = New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment
        pProjectionSet = pSpatialRefFact.CreatePredefinedProjections
        Debug.Print(pProjectionSet.Count)
        Dim i As Integer
        pProjectionSet.Reset()
        For i = 0 To pProjectionSet.Count - 1
            pProjection = pProjectionSet.Next
            Debug.Print(pProjection.Name)
        Next i

See Also

ISpatialReferenceFactory Interface