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


ISpatialReferenceFactory.CreateParameter Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Geometry)  

ISpatialReferenceFactory.CreateParameter Method

Creates a predefined parameter.

[Visual Basic .NET]
Public Function CreateParameter ( _
    ByVal parameterType As Integer _
) As IParameter
[C#]
public IParameter CreateParameter (
    int parameterType
);
[C++]
HRESULT CreateParameter(
  long parameterType,
  IParameter** newParameter
);
[C++]

Parameters parameterType parameterType is a parameter of type long newParameter [out, retval]
newParameter is a parameter of type IParameter

Product Availability

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

Description

Use an element from the esriSRParameterTypeesriSRParameter2Type, esriSRParameter3Type, or esriSRParameter4Type enumerations as the ParameterType to create a particular predefined parameter.

[C#]

            ISpatialReferenceFactory spatialReferenceFactory=new SpatialReferenceEnvironmentClass(); // Declare an array of IParameters, and for each, create the required Parameter object
            // by using ISpatialReferenceFactory::CreateParamater. Then assign the parameter
            // a value. Below is an example used for a Transverse Mercator projection
            IParameter[] parameterArray=new IParameter[5];
            parameterArray[0]=spatialReferenceFactory.CreateParameter((int)esriSRParameterType.esriSRParameter_FalseEasting);
            parameterArray[0].Value=500000;
            parameterArray[1]=spatialReferenceFactory.CreateParameter((int)esriSRParameterType.esriSRParameter_FalseNorthing);
            parameterArray[1].Value=0;
            parameterArray[2]=spatialReferenceFactory.CreateParameter((int)esriSRParameterType.esriSRParameter_CentralMeridian);
            parameterArray[2].Value=-123;
            parameterArray[3]=spatialReferenceFactory.CreateParameter((int)esriSRParameterType.esriSRParameter_LatitudeOfOrigin);
            parameterArray[3].Value=0;
            parameterArray[4]=spatialReferenceFactory.CreateParameter((int)esriSRParameterType.esriSRParameter_ScaleFactor);
            parameterArray[4].Value=0.9996;

[Visual Basic .NET]

        'This example shows you how to declare a safe array of IParameter,
        'and for each, create the required Parameter object by using
        'ISpatialReferenceFactory::CreateParameter and assign each parameter a value.
        'Parameter types can be found in the esriGeometry esriSRParameterType
        'enumeration.  Below is an example used for a Transverse Mercator projection.


        Dim pSpatRefFact As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory
        pSpatRefFact=New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment

        Dim aParamArray(5) As ESRI.ArcGIS.Geometry.IParameter
        aParamArray(0)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_FalseEasting)
        aParamArray(0).Value=500000
        aParamArray(1)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_FalseNorthing)
        aParamArray(1).Value=0
        aParamArray(2)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_CentralMeridian)
        aParamArray(2).Value=-123
        aParamArray(3)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_LatitudeOfOrigin)
        aParamArray(3).Value=0
        aParamArray(4)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_ScaleFactor)
        aParamArray(4).Value=0.9996


        'Below is an example for an Albers projection:


        Dim pSpatRefFact As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory
        pSpatRefFact=New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment

        Dim aParamArray(6) As ESRI.ArcGIS.Geometry.IParameter
        aParamArray(0)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_FalseEasting)
        aParamArray(0).Value=0
        aParamArray(1)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_FalseNorthing)
        aParamArray(1).Value=0
        aParamArray(2)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_CentralMeridian)
        aParamArray(2).Value=-96
        aParamArray(3)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_StandardParallel1)
        aParamArray(3).Value=29.5
        aParamArray(4)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_StandardParallel2)
        aParamArray(4).Value=45.5
        aParamArray(5)=pSpatRefFact.CreateParameter(ESRI.ArcGIS.Geometry.esriSRParameterType.esriSRParameter_CentralParallel)
        aParamArray(5).Value=37.5

See Also

ISpatialReferenceFactory Interface | esriSRParameterType Constants | esriSRParameter2Type Constants | esriSRParameter3Type Constants | esriSRParameter4Type Constants

.NET Related Topics

Creating a custom projected coordinate system