![]() ![]() |
ESRI.ArcGIS.ADF.IMS | |
ServiceSpatialReference Property | |
See Also Example Send Feedback |
ESRI.ArcGIS.ADF.IMS.Carto Namespace > MapService Class : ServiceSpatialReference Property |
Visual Basic (Declaration) | |
---|---|
Public ReadOnly Property ServiceSpatialReference As SpatialReference |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As MapService Dim value As SpatialReference value = instance.ServiceSpatialReference |
C# | |
---|---|
public SpatialReference ServiceSpatialReference {get;} |
The following example retrieves the SpatialReference object from an existing MapService object and prints its coordinate system ID or definition string.
C# | ![]() |
---|---|
// 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 Basic | ![]() |
---|---|
' 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 |
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.
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