Gets the Layers extent.
Namespace:
ESRI.ArcGISExplorer.MappingAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public virtual Envelope Extent { get; } |
Visual Basic (Declaration) |
---|
Public Overridable ReadOnly Property Extent As Envelope |
Field Value
An Envelope object representing the geographical extent of the Layers underlying data; nullNothingnullptra null reference (Nothing in Visual Basic) if the Layer is not connected.Remarks
Use the Extent property to retrieve the geographical bounds of the data referenced by a Layer. The extent is dependent on underlying
data and therefore the Layer must be connected before this property can be utilized. If the Layer is not connected, this property will
return nullNothingnullptra null reference (Nothing in Visual Basic).
Examples
The code below shows how to open a FeatureLayer that references data in a file geodatabase, prints out the extent and coordinate system
for the Layer, and disconnects the Layer from the underlying data.
CopyC#
//The static Open methods will return an instance of a concrete layer type. //If the connection information specified is incorrect, an exception will be thrown, therefore //use a try... catch block to handle the exception. try { //Open a FeatureLayer based on a File Geodatabase feature class FeatureLayer featureLayer = FeatureLayer.OpenFileGeodatabaseTable(@"C:\Data\Forestry.gdb", "road_hazards"); //Print out coordinate system and extent of the layer- these properties can only be accessed when the layer is //connected to its underlying data source System.Diagnostics.Debug.Print(featureLayer.CoordinateSystem.ToString()); System.Diagnostics.Debug.Print(featureLayer.Extent.ToString()); //Finished accessing the data, so Disconnect the layer from its data source featureLayer.Disconnect(); } catch (ESRI.ArcGISExplorer.ConnectionException ex) { System.Diagnostics.Debug.Print(ex.Message); }
CopyVB.NET
'The static Open methods will return an instance of a concrete layer type. 'If the connection information specified is incorrect, an exception will be thrown, therefore 'use a try... catch block to handle the exception. Try 'Open a FeatureLayer based on a File Geodatabase feature class Dim featureLayer As FeatureLayer = featureLayer.OpenFileGeodatabaseTable("C:\Data\Forestry.gdb", "road_hazards") 'Print out coordinate system and extent of the layer- these properties can only be accessed when the layer is 'connected to its underlying data source System.Diagnostics.Debug.Print(featureLayer.CoordinateSystem.ToString()) System.Diagnostics.Debug.Print(featureLayer.Extent.ToString()) 'Finished accessing the data, so Disconnect the layer from its data source featureLayer.Disconnect() Catch ex As ESRI.ArcGISExplorer.ConnectionException System.Diagnostics.Debug.Print(ex.Message) End Try