ArcObjects Library Reference (Geometry)  

ISpatialReferenceFactory Interface

Provides access to members that create different kinds of spatial reference components. Note: the ISpatialReferenceFactory interface has been superseded byISpatialReferenceFactory3. Please consider using the more recent version.

Product Availability

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

Members

Description
Method CreateDatum Creates a predefined datum.
Method CreateESRISpatialReference Creates a spatial reference system and defines it from the specified ESRISpatialReference buffer.
Method CreateESRISpatialReferenceFromPRJ Creates a spatial reference from a PRJ string.
Method CreateESRISpatialReferenceFromPRJFile Creates a spatial reference from a PRJ file.
Method CreateGeographicCoordinateSystem Creates a predefined geographic coordinate system.
Method CreateGeoTransformation Creates a predefined transformation between geographic coordinate systems.
Method CreateParameter Creates a predefined parameter.
Method CreatePredefinedAngularUnits Creates a list of predefined angular units.
Method CreatePredefinedDatums Creates a list of a list of predefined datums.
Method CreatePredefinedLinearUnits Creates a list of predefined linear units.
Method CreatePredefinedPrimeMeridians Creates a list of predefined prime meridians.
Method CreatePredefinedProjections Creates a list of predefined projections.
Method CreatePredefinedSpheroids Creates a list of predefined spheroids.
Method CreatePrimeMeridian Creates a predefined prime meridian.
Method CreateProjectedCoordinateSystem Creates a predefined projected coordinate system.
Method CreateProjection Creates a predefined projection.
Method CreateSpheroid Creates a predefined spheroid.
Method CreateUnit Creates a predefined unit of measure.
Method ExportESRISpatialReferenceToPRJFile Exports a spatial reference to a PRJ file.

CoClasses that implement ISpatialReferenceFactory

CoClasses and Classes Description
SpatialReferenceEnvironment Creates various spatial reference objects.

Remarks

The ISpatialReferenceFactory interface provides methods that use the FactoryCode to generate predefined factory spatial reference objects. There are three types of functions on this interface: those that return single objects, those that return a set of objects of the same type, and those that are used to import and export SpatialReference objects to and from a PRJ file or a PRJ string representation. For example, the CreateGeographicCoordinateSystem function takes as its only parameter an integer that represents the FactoryCode of a predefined geographic coordinate system. The function returns a GCS whose coordinate system has been defined. Its coordinate grids and tolerance, though, have not yet been defined.

Thousands of coordinate system related objects are available through the esriSR... enumerations. To maintain compatibility between versions, each object, such as a geographic coordinate system, will have more than one enumeration. Use the enumeration elements (for example, esriSRGeoCS_WGS1984) rather than the integer value it represents. Many of the FactoryCode values are based on an external standard and the values may change.

The next type of function on the ISpatialReferenceFactory interface returns a complete Set of objects. These type of functions are useful for developers who may wish to populate a pulldown selection list of available SpatialReference objects.

The third type of function supported by ISpatialReferenceFactory deals with PRJ files and strings. CreateESRISpatialReferenceFromPRJFile takes an old or new style PRJ file and creates either a geographic or projected coordinate system from it, depending on the file contents. The old style PRJ is used with coverages, TINs, and GRIDs. CreateESRISpatialReferenceFromPRJ is used to create a SpatialReference based on the string buffer of an old style PRJ file. While CreateESRISpatialReference is similar, the string buffer must be in the format of a new PRJ file. Conversely, the ExportESRISpatialReferenceToPRJFile function provides a mechanism to take a SpatialReference object and create a new style PRJ file from it. These four functions provide you with a way to take advantage of existing routines that involve the use of PRJ files. They also provide an easy and effective way to exchange spatial reference information through the use of text files. If you plan to work with vertical coordinate systems, use the ISpatialReferenceFactory3 versions of these methods.

.NET Samples

Clonable object (Code Files: TestClass) | Create a custom raster type (Code Files: TestThumbnailBuilder) | Create a Mosaic dataset (Code Files: CreateMosaicDataset) | RSS weather GraphicTracker (Code Files: RSSWeather) | RSS weather layer (Code Files: RSSWeatherLayerClass) | StreetMap routing (Code Files: RoutingForm) |

.NET Related Topics

Creating a predefined geographic coordinate system | Creating a predefined projected coordinate system | Creating a predefined vertical coordinate system | Creating feature classes | Geometry | How to create a Mosaic dataset | Working with GeometryEnvironment |