![]() ![]() |
ESRI.ArcGIS.ADF.IMS | |
SpatialReference Class | |
Members Example See Also Send Feedback |
ESRI.ArcGIS.ADF.IMS.SpatialReference Namespace : SpatialReference Class |

Visual Basic (Declaration) | |
---|---|
<SerializableAttribute()> Public Class SpatialReference |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As SpatialReference |
C# | |
---|---|
[SerializableAttribute()] public class SpatialReference |
C# | ![]() |
---|---|
// Define the spatial reference of the layer // The datum transformation - Old Hawaiian to WGS84 (Oahu) ESRI.ArcGIS.ADF.IMS.SpatialReference.IDSpatialReferenceInfo layerDatumTransformation = new ESRI.ArcGIS.ADF.IMS.SpatialReference.IDSpatialReferenceInfo(108012); // The coordinate system - Old_Hawaiian_StatePlane_Hawaii_3_FIPS_5103 ESRI.ArcGIS.ADF.IMS.SpatialReference.IDSpatialReferenceInfo layerCoordSys = new ESRI.ArcGIS.ADF.IMS.SpatialReference.IDSpatialReferenceInfo(3563); // The spatial reference, using the datum transformation and coordinate system ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference layerSpatialRef = new ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference(); layerSpatialRef.DatumTransformation = layerDatumTransformation; layerSpatialRef.CoordinateSystem = layerCoordSys; // Create a new FeatureLayer from a new shapeworkspace and data set ESRI.ArcGIS.ADF.IMS.Data.ShapeWorkspace newWS = new ESRI.ArcGIS.ADF.IMS.Data.ShapeWorkspace("OahuWS", @"D:\Data"); ESRI.ArcGIS.ADF.IMS.Data.FeatureDataset newDataset = new ESRI.ArcGIS.ADF.IMS.Data.FeatureDataset("Oahu", newWS); ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer dynamicLayer = new ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("OahuCoastline", newDataset); dynamicLayer.Type = ESRI.ArcGIS.ADF.IMS.FeatureType.Polygon; // Set the spatial reference by the property in the dataset newDataset.SpatialReference = layerSpatialRef; // Assign a new renderer to the dynamic layer ESRI.ArcGIS.ADF.IMS.Display.Renderer.SimpleRenderer layerRenderer = ESRI.ArcGIS.ADF.IMS.Display.Renderer.SimpleRenderer.Create( ESRI.ArcGIS.ADF.IMS.FeatureType.Polygon, System.Drawing.Color.Green); dynamicLayer.Renderer = layerRenderer; // Add the dynamic layer to the map and draw the map mapView.Layers.Add(dynamicLayer); |
Visual Basic | ![]() |
---|---|
' Define the spatial reference of the layer ' The datum transformation - Old Hawaiian to WGS84 (Oahu) Dim layerDatumTransformation As New _ ESRI.ArcGIS.ADF.IMS.SpatialReference.IDSpatialReferenceInfo(108012) ' The coordinate system - Old_Hawaiian_StatePlane_Hawaii_3_FIPS_5103 Dim layerCoordSys As New _ ESRI.ArcGIS.ADF.IMS.SpatialReference.IDSpatialReferenceInfo(3563) ' The spatial reference, using the datum transformation and coordinate system Dim layerSpatialRef As New _ ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference() layerSpatialRef.DatumTransformation = layerDatumTransformation layerSpatialRef.CoordinateSystem = layerCoordSys ' Create a new FeatureLayer from a new shapeworkspace and data set Dim newWS As New _ ESRI.ArcGIS.ADF.IMS.Data.ShapeWorkspace("OahuWS", "D:\Data") Dim newDataset As New _ ESRI.ArcGIS.ADF.IMS.Data.FeatureDataset("Oahu", newWS) Dim dynamicLayer As New _ ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("OahuCoastline", newDataset) dynamicLayer.Type = ESRI.ArcGIS.ADF.IMS.FeatureType.Polygon ' Set the spatial reference by the property in the dataset newDataset.SpatialReference = layerSpatialRef ' Assign a new renderer to the dynamic layer Dim layerRenderer As ESRI.ArcGIS.ADF.IMS.Display.Renderer.SimpleRenderer = _ ESRI.ArcGIS.ADF.IMS.Display.Renderer.SimpleRenderer.Create( _ ESRI.ArcGIS.ADF.IMS.FeatureType.Polygon, System.Drawing.Color.Green) dynamicLayer.Renderer = layerRenderer ' Add the dynamic layer to the map and draw the map mapView.Layers.Add(dynamicLayer) |
SpatialReference can be used to define the coordinate system (projection) and optionally the datum transformation for many map elements, including:
- MapService - the spatial reference of the ArcIMS map service
- MapView - get or set the projection of the map
- DataFrame - the spatial reference of an ArcMap image service data frame
- QueryParameters - the spatial reference for the query output
- FeatureDataset and ImageDataset - the spatial reference for a dynamically added layer
- Classes that extend Geometry, such as Envelope - the projection for querying or displaying with geometry.
Not every instance of these classes will have or require a SpatialReference. SpatialReference is most commonly employed when multiple coordinate systems or datums are used within the application.
A SpatialReference normally includes a CoordinateSystem setting. The coordinate system defines how latitude-longitude coordinates are transformed onto 2-dimension x-y coordinates. The SpatialReference may also include a DatumTransformation, which defines a tranformation to or from the WGS84 ellipsoid.
The CoordinateSystem and DatumTransformation may be set either using an integer ID value or with a definition string. Commonly used projections and datum transformations have been assigned ID values. Use IDSpatialReferenceInfo when setting the coordinate system or datum transformation by ID. Definition strings allow flexibility to set parameters for the coordinate system or datum transformation. Use DefinitionSpatialReferenceInfo to set the coordinate system or datum transformation with a definition string.
If an ID value is available for the coordinate system or datum transformation, it is normally more convenient to use the ID rather than the definition string. If a custom projection is needed, such as for a non-standard central meridian, it may be necessary to use the definition string.
A SpatialReference returned by the ArcIMS server for a MapService or MapView will use DefinitionSpatialReferenceInfo for coordinate system and datum transformation (if included).
See ArcIMS Help, under ArcXML Guide, for IDs and definition strings for particular coordinate systems and datum transformations. Also see ArcIMS Help for general information on coordinate systems and datum transformations.
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family