Class GeocodingService
public sealed class GeocodingService : IGeocoder, IDisposable
- Inheritance
-
objectGeocodingService
- Implements
Constructors
GeocodingService(string, Func<string, string, CancellationToken, Task<string>>, string)
public GeocodingService(string endpoint = null, Func<string, string, CancellationToken, Task<string>> transport = null, string userAgent = null)
Parameters
Fields
NominatimEndpoint
public const string NominatimEndpoint = "https://nominatim.openstreetmap.org/search?format=jsonv2&limit=8&q="
Field Value
NominatimReverseEndpoint
public const string NominatimReverseEndpoint = "https://nominatim.openstreetmap.org/reverse?format=jsonv2"
Field Value
Properties
SearchPending
True while a search has been started and has not completed.
public bool SearchPending { get; }
Property Value
UserAgent
public string UserAgent { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Search(string)
Starts a search for a place name; returns immediately.
public void Search(string query)
Parameters
querystringFree-form place name typed by a user.
SearchReverse(LatLon)
Starts a search for the place at a position; returns immediately.
public void SearchReverse(LatLon position)
Parameters
positionLatLonPosition in degrees WGS84.
TryGetResults(List<GeocodeResult>)
Takes the results of a completed search.
public bool TryGetResults(List<GeocodeResult> results)
Parameters
resultsList<GeocodeResult>Filled with the results, best first, and left empty when the search found nothing or failed.
Returns
- bool
True exactly once per completed search, false while one is still running or when none was started.