IESRISpatialReference Interface

Provides access to members that control the import/export operations components of a spatial reference system. This interface is same as IESRISpatialReferenceGEN.

Description

This interface can be used by developers who are familiar with the Projection Engine format for persisting string representations of these components. The ESRISpatialReferenceSize property returns the number of bytes required to hold the projection engine string representation of object implementing this interface. This number is guaranteed to be large enough but may be larger than needed. The number returned from ExportToESRISpatialReference is the exact number of bytes used in the buffer to hold the string. The example code, which demonstrates how to use this method, expects that a valid SpatialReference object has already been created.

The ImportFromESRISpatialReference method defines a spatial reference from its Projection Engine string representation. If you open up a PRJ file in Notepad that contains the string description of a ProjectedCoordinateSystem, you will see something like (but as a single line):

PROJCS["Test",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984", 
SPHEROID["WGS_1984",6378137,298.257223]],PRIMEM["Greenwich",0], 
UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"], 
PARAMETER["false_easting",1000000],UNIT["Foot",0.3048]] 

Members

Name Description
Read-only property ESRISpatialReferenceSize The number of bytes required to hold the persistant representation of this spatial reference component.
Method ExportToESRISpatialReference Exports this spatial reference component to a buffer.
Method ImportFromESRISpatialReference Defines this spatial reference component from the specified ESRISpatialReference buffer.

IESRISpatialReference.ESRISpatialReferenceSize Property

The number of bytes required to hold the persistant representation of this spatial reference component.

Public ReadOnly Property ESRISpatialReferenceSize As Integer
public int ESRISpatialReferenceSize {get;}

Description

Returns the size in bytes required to hold the persistent representation of a coordinate system. A sample string representation is below (reformatted for display).

PROJCS["Porto_Santo_1936_UTM_Zone_28N",  GEOGCS["GCS_Porto_Santo_1936",    DATUM["D_Porto_Santo_1936",    SPHEROID["International_1924",6378388,297]],    PRIMEM["Greenwich",0],    UNIT["Degree",0.0174532925199432955]],  PROJECTION["Transverse_Mercator"],  PARAMETER["False_Easting",500000],  PARAMETER["False_Northing",0],  PARAMETER["Central_Meridian",-15],  PARAMETER["Scale_Factor",0.9996],  PARAMETER["Latitude_Of_Origin",0],  UNIT["Meter",1]]

IESRISpatialReference.ExportToESRISpatialReference Method

Exports this spatial reference component to a buffer.

Public Sub ExportToESRISpatialReference ( _
    ByRef str As String, _
    ByRef cBytesWrote As Integer _
)
public void ExportToESRISpatialReference (
    ref string str,
    ref int cBytesWrote
);

Description

Converts a spatial reference object into the string representation of a coordinate system. A sample string representation is below (reformatted for display).

PROJCS["Porto_Santo_1936_UTM_Zone_28N",
  GEOGCS["GCS_Porto_Santo_1936",
    DATUM["D_Porto_Santo_1936",
    SPHEROID["International_1924",6378388,297]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.0174532925199432955]],
  PROJECTION["Transverse_Mercator"],
  PARAMETER["False_Easting",500000],
  PARAMETER["False_Northing",0],
  PARAMETER["Central_Meridian",-15],
  PARAMETER["Scale_Factor",0.9996],
  PARAMETER["Latitude_Of_Origin",0],
  UNIT["Meter",1]]

IESRISpatialReference.ImportFromESRISpatialReference Method

Defines this spatial reference component from the specified ESRISpatialReference buffer.

Public Sub ImportFromESRISpatialReference ( _
    ByVal str As String, _
    ByRef cBytesRead As Integer _
)
public void ImportFromESRISpatialReference (
    string str,
    ref int cBytesRead
);

Description

Converts a string representation of a coordinate system into a spatial reference object. A sample string representation is below (reformatted for display).

PROJCS["Porto_Santo_1936_UTM_Zone_28N",
  GEOGCS["GCS_Porto_Santo_1936",
    DATUM["D_Porto_Santo_1936",
    SPHEROID["International_1924",6378388,297]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.0174532925199432955]],
  PROJECTION["Transverse_Mercator"],
  PARAMETER["False_Easting",500000],
  PARAMETER["False_Northing",0],
  PARAMETER["Central_Meridian",-15],
  PARAMETER["Scale_Factor",0.9996],
  PARAMETER["Latitude_Of_Origin",0],
  UNIT["Meter",1]]
public ISpatialReference IESRISpatialReferenceExample()

     {

         int size = -1;

         //Not Parameter keyword

         //Note also the back slash around false_easting so that the double quotation marks will read correctly

         string wktString = "PROJCS[\"Test\", GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\", 6378137, 298.257223]], PRIMEM[\"Greenwich\", 0],UNIT[\"Degree\", 0.0174532925199433]], PROJECTION[\"Mercator\"],PARAMETER[\"false_easting\", 1000000], UNIT[\"Foot\", 0.3048]]";

         //Create an ESRISpatialReference using the parameter class

         IESRISpatialReference esriSpatialReferenceProjection = new ProjectedCoordinateSystemClass() as IESRISpatialReference;

         esriSpatialReferenceProjection.ImportFromESRISpatialReference(wktString, out size);

         //Set your parameter to the one you just created

         ISpatialReference spatialReference = esriSpatialReferenceProjection as ISpatialReference;

         return spatialReference;

     }

Classes that implement IESRISpatialReference

Classes Description
AngularUnit Creates a angular unit of measure.
Datum Creates a datum.
GeographicCoordinateSystem Creates a geographic coordinate system.
LinearUnit Creates a linear unit of measure.
Parameter Creates a parameter.
PrimeMeridian Creates a prime meridian.
ProjectedCoordinateSystem Creates a projected coordinate system.
Projection Creates a map projection.
Spheroid Creates a spheroid.
UnknownCoordinateSystem Creates an unknown coordinate system.
VerticalCoordinateSystem Creates a vertical coordinate system.
VerticalDatum Creates a vertical datum.

Remarks

If working with a .NET language or Java, use the IESRISpatialReferenceGEN interface.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.