ESRI.ArcGIS.ADF.IMS
ServiceSpatialReference Property
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto Namespace > MapService Class : ServiceSpatialReference Property




The Spatial Reference properties of the ArcIMS Service for this Map.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property ServiceSpatialReference As SpatialReference
Visual Basic (Usage)Copy Code
Dim instance As MapService
Dim value As SpatialReference
 
value = instance.ServiceSpatialReference
C# 
public SpatialReference ServiceSpatialReference {get;}

Example

The following example retrieves the SpatialReference object from an existing MapService object and prints its coordinate system ID or definition string.
C#Copy Code
// Retrieve SpatialReference from previously created MapService 

SpatialReference spatialRef = mapService.ServiceSpatialReference; 

  

// Make sure the SpatialReference exists 

if (spatialRef != null) 



  

    // Print coordinate system information 

    if (spatialRef.CoordinateSystem is IDSpatialReferenceInfo) 

    { 

        IDSpatialReferenceInfo idInfo = (IDSpatialReferenceInfo)spatialRef.CoordinateSystem; 

        lblSpatialRef.Text = "Coordinate system ID = " + idInfo.ID.ToString(); 

    } 

    else 

    { 

        DefinitionSpatialReferenceInfo defInfo = (DefinitionSpatialReferenceInfo)spatialRef.CoordinateSystem; 

        lblSpatialRef.Text = "Coordinate system description = " + defInfo.Definition; 

    } 



    
Visual BasicCopy Code
' Retrieve SpatialReference from previously created MapService

Dim spatialRef As SpatialReference = mapService.ServiceSpatialReference



' Make sure the SpatialReference exists

If Not IsNothing(spatialRef) Then



    ' Print coordinate system information

    If Typeof spatialRef.CoordinateSystem Is IDSpatialReferenceInfo Then

        IDSpatialReferenceInfo idInfo = CType(spatialRef.CoordinateSystem, IDSpatialReferenceInfo)

        lblSpatialRef.Text = "Coordinate system ID = " + idInfo.ID.ToString()

    Else

        DefinitionSpatialReferenceInfo defInfo = CType(spatialRef.CoordinateSystem, DefinitionSpatialReferenceInfo)

        lblSpatialRef.Text = "Coordinate system description = " + defInfo.Definition

    End If



End If

Remarks

May be null (Nothing) after initializing MapService if no coordinate system information has been added to the configuration file for the ArcIMS map service. Check that the object exists before accessing the spatial reference's properties.

This property, as with all properties of MapService, is read-only.

See Also

© 2010 All Rights Reserved.