Click or drag to resize

DataQueryFindNearestLines Method (LatLon, String, Double, CancellationToken)

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Finds the nearest Line (such as a stream or railway line) to the location given, in the specified table. See CustomTable for a list of predefined tables.

Namespace:  Telogis.GeoBase
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public static Line[] FindNearestLines(
	LatLon location,
	string tableName,
	double simplificationLevel,
	CancellationToken token
)

Parameters

location
Type: Telogis.GeoBaseLatLon
The location to query.
tableName
Type: SystemString
The line table to query. See CustomTable for a list of predefined tables.
simplificationLevel
Type: SystemDouble
Level used to simplify results, given as meters per pixel.
token
Type: Telogis.GeoBase.ConcurrencyCancellationToken
A CancellationToken that can be used to cancel the query, causing a DataQueryCanceledException to be thrown.

Return Value

Type: Line
The nearest Lines. There may be more than one if the query point touches one or more Line objects. An empty array is returned if there are no results.
Remarks
Map features are stored in named tables. See QueryLines(BoundingBox, String)
Examples
C#
// Query a location in Los Angeles, USA
LatLon queryLocation = new LatLon(33.767528,-118.092072);

CancellationToken token = new CancellationToken();

// Get the first line result from the array. 500 meters per pixel
// Available line tables 'all', 'railways', 'rivers', 'canals'
Line result = DataQuery.FindNearestLines(queryLocation, "railways", 500, token)[0];

// Convert to human-friendly number
Double dist = result.DistanceTo(queryLocation, DistanceUnit.MILES);
Decimal distShort = (Decimal)(Math.Truncate((Double)dist * 100.0) / 100.0);

// Write the distance to the console
Console.WriteLine("The nearest railway line is {0} miles from the query location", distShort);
// 'The nearest railway line is 5.36 miles from the query location'
See Also