Table of Contents

Class GeocodingService

Namespace
LansMap.Map.Geocoding
public sealed class GeocodingService : IGeocoder, IDisposable
Inheritance
object
GeocodingService
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

endpoint string
transport Func<string, string, CancellationToken, Task<string>>
userAgent string

Fields

NominatimEndpoint

public const string NominatimEndpoint = "https://nominatim.openstreetmap.org/search?format=jsonv2&limit=8&q="

Field Value

string

NominatimReverseEndpoint

public const string NominatimReverseEndpoint = "https://nominatim.openstreetmap.org/reverse?format=jsonv2"

Field Value

string

Properties

SearchPending

True while a search has been started and has not completed.

public bool SearchPending { get; }

Property Value

bool

UserAgent

public string UserAgent { get; }

Property Value

string

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

query string

Free-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

position LatLon

Position in degrees WGS84.

TryGetResults(List<GeocodeResult>)

Takes the results of a completed search.

public bool TryGetResults(List<GeocodeResult> results)

Parameters

results List<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.