Creates a spatial reference from a PRJ file.
[Visual Basic .NET] Public Function CreateESRISpatialReferenceFromPRJFile ( _ ByVal prjFile As String _ ) As ISpatialReference
[C#] public ISpatialReference CreateESRISpatialReferenceFromPRJFile ( string prjFile );
[C++]
HRESULT CreateESRISpatialReferenceFromPRJFile(
BSTR prjFile,
ISpatialReference** SpatialReference
);
[C++]Parameters
prjFile prjFile is a parameter of type BSTR SpatialReference [out, retval]SpatialReference is a parameter of type ISpatialReference
Product Availability
Remarks
Both old style (workstation) and new style (arcview) prj files can be used with this method to create spatial reference system objects.
public void CreateESRISpatialReferenceFromPRJFileExample()
{
//The ISpatialReferenceFactory::CreateESRISpatialReferenceFromPRJFile
//method requires that you specify the path and filename of the PRJ
//file you wish to import to create a spatial reference from.
// use activator class with SpatialReferenceEnvironment singleton
Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
System.Object obj = Activator.CreateInstance(factoryType);
ISpatialReferenceFactory3 spatialReferenceFactory = obj as ISpatialReferenceFactory3;
ISpatialReference spatialReference = spatialReferenceFactory.
CreateESRISpatialReferenceFromPRJFile("C:\\Program Files\\ArcGIS\\Coordinate Systems\\Geographic Coordinate Systems\\World\\WGS 1984.prj");
}
'The ISpatialReferenceFactory::CreateESRISpatialReferenceFromPRJFile
'method requires that you specify the path and filename of the PRJ
'file you wish to import to create a spatial reference from.
Dim pSpatRefFact As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory
pSpatRefFact = New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment
Dim pSpatRef As ESRI.ArcGIS.Geometry.ISpatialReference
pSpatRef = pSpatRefFact.CreateESRISpatialReferenceFromPRJFile("c:\geodata\prj_import.prj")