Click or drag to resize

DataQueryFindNearestPoints Method (LatLon, String, CancellationToken)

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Finds the nearest PointFeature (usually a city) 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 PointFeature[] FindNearestPoints(
	LatLon location,
	string tableName,
	CancellationToken token
)

Parameters

location
Type: Telogis.GeoBaseLatLon
The location to query.
tableName
Type: SystemString
The point table to query. See CustomTable for a list of predefined tables.
token
Type: Telogis.GeoBase.ConcurrencyCancellationToken
A CancellationToken that can be used to cancel the query, causing a DataQueryCanceledException to be thrown.

Return Value

Type: PointFeature
The nearest PointFeatures. There may be more than one if the query point touches one or more points. An empty array is returned if there are no results.
Remarks
Map features are stored in named tables. See QueryPoints(BoundingBox, String)
Examples
C#
// 
// This example will use a GPS unit to find the current location,
// and then perform a DataQuery to find the nearest canal to our
// current location...
// 

SerialPort myPort = new SerialPort(); // create the GPS's serial port
myPort.PortName = "COM1"; // configure the serial port
myPort.BaudRate = 9600;

IGps myGps = new NMEAGps(myPort); // create GPS unit
myGps.PowerUp(); // power up the GPS, ready for use

CancellationToken token = new CancellationToken(); // create a cancellation token

LatLon myLoc = myGps.Position.location; // get the current location

PointFeature mCity = DataQuery.FindNearestPoints(myLoc, "major_cities", token)[0];
// ^^ get the nearest major city to our current location

...

// if we have a map, we can center it on the city
myMap.Center(mCity.Point);
See Also