ArcGIS Explorer Component Help |
Table..::.SearchByDistance Method |
Table Class Example See Also |
Returns a collection of rows from the Table which are within a certain distance of the supplied geometry.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public RowCollection SearchByDistance( Point point, double distance, Unit unit ) |
Visual Basic (Declaration) |
---|
Public Function SearchByDistance ( _ point As Point, _ distance As Double, _ unit As Unit _ ) As RowCollection |
Parameters
- point
- Type: ESRI.ArcGISExplorer.Geometry..::.Point
A Point object representing the seed location for the query and which will be buffered by the specified distance to create a polygon to search within.
- distance
- Type: System..::.Double
The distance in the specified units to buffer the supplied geometry by.
- unit
- Type: ESRI.ArcGISExplorer.Geometry..::.Unit
The specific unit of measurement but which must always be linear values.
Return Value
A RowCollection object which contains Row objects each of which represents a record in the Table.Remarks
The point can use a geographic or projected CoordinateSystem, but the search distance units must always be linear units, otherwise an exception will be thrown.
For more information on using the SearchByDistance method, see How to Search a Table.
Examples
The code below demonstrates how to use the SearchByDistance method to find all the tree stands within 50 meters of a
proposed phone mast location.
CopyC#
//Open Forestry file geodatabase Geodatabase gdb = new Geodatabase(@"C:\Data\Forestry.gdb"); //Open the SCPTDATA feature class containing polygons representing the tree stands. Table treeStandsTable = gdb.OpenTable("SCPTDATA"); //Open the PHONEMASTS feature class Table mastsTable = gdb.OpenTable("PHONEMASTS"); //Return the Point for a proposed phone mast ESRI.ArcGISExplorer.Geometry.Point mastLocation = mastsTable.Search(new Filter("MAST_REF='1938-O2'")).GetFirst().Geometry as ESRI.ArcGISExplorer.Geometry.Point; //The new mast needs 50 meters of space around it so perform an analysis using the //SearchByDistance method to find out which stands of trees will be affected RowCollection affectedTreeStands = treeStandsTable.SearchByDistance(mastLocation, 50, Unit.Linear.Meters);
CopyVB.NET
'Open Forestry file geodatabase Dim gdb As Geodatabase = New Geodatabase("C:\Data\Forestry.gdb") 'Open the SCPTDATA feature class containing polygons representing the tree stands. Dim treeStandsTable As Table = gdb.OpenTable("SCPTDATA") 'Open the PHONEMASTS feature class Dim mastsTable As Table = gdb.OpenTable("PHONEMASTS") 'Return the Point for a proposed phone mast Dim mastLocation As ESRI.ArcGISExplorer.Geometry.Point = DirectCast(mastsTable.Search(New Filter("MAST_REF='1938-O2'")).GetFirst().Geometry, ESRI.ArcGISExplorer.Geometry.Point) 'The new mast needs 50 meters of space around it so perform an analysis using the 'SearchByDistance method to find out which stands of trees will be affected Dim affectedTreeStands As RowCollection = treeStandsTable.SearchByDistance(mastLocation, 50, Unit.Linear.Meters)
Exceptions
Exception | Condition |
---|---|
System..::.NotSupportedException | The unit cannot be angular units. |