AutocompleteGeocoderGeocode Method (String, Country, LatLon, TimeSpan) | |
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Generate a set of address suggestions for a specific country, based on a partial address string, optionally ordered by proximity to a
LatLon
location hint.
Namespace:
Telogis.GeoBase.Geocoding
Assembly:
geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax public static AutocompleteGeocoderResult Geocode(
string query,
Country country,
LatLon locationHint,
TimeSpan timeout
)
Public Shared Function Geocode (
query As String,
country As Country,
locationHint As LatLon,
timeout As TimeSpan
) As AutocompleteGeocoderResult
Parameters
- query
- Type: SystemString
The partial address string for which to search. - country
- Type: Telogis.GeoBaseCountry
The Country in which to search. - locationHint
- Type: Telogis.GeoBaseLatLon
An optional LatLon value. Suggestions returned by the AutocompleteGeocoder
will be ordered based on their proximity to this location, from nearest to furthest. If you do not wish to use a location hint, this parameter should be set to
Empty. - timeout
- Type: SystemTimeSpan
Specifies how long the search should continue before terminating prematurely. Specifying a timeout of
TimeSpan.Zero means that the search will not timeout. When a search times out, the
AutocompleteGeocoderResult object returned will contain all suggestions found
prior to the timeout, and have a status of Timeout.
Return Value
Type:
AutocompleteGeocoderResultAn
AutocompleteGeocoderResult object, containing an array of suggestions along with a status code.
Remarks Due to the potential for latency, running this method on a non-UI thread is recommended. See the
Autocomplete Geocoder Tutorial
for an example of a threaded implementation.
Examples AutocompleteGeocoderResult result = AutocompleteGeocoder.Geocode("Rua Treze, Jaguar", Country.Brazil, LatLon.Empty, TimeSpan.FromSeconds(2));
if (result.Status == SearchResult.SearchCompleted && result.Suggestions.Length == 0) {
Console.WriteLine("No results found.");
} else if (result.Status == SearchCancelled) {
Console.WriteLine("Search was canceled.");
} else {
if (result.Status == SearchResult.TooManyResults || result.Status == SearchResult.Timeout) {
Console.WriteLine("Too many results for the string provided. Further qualify the address to see further suggestions.");
} else if (result.Status == SearchResult.SearchCompleted) {
Console.WriteLine("Search completed.");
}
foreach (AutocompleteGeocoderSuggestion suggestion in result.Suggestions) {
Console.WriteLine(suggestion.ToString());
}
}
See Also