Tiger_Location_Adapter_Nominatim

@api · extends Tiger_Location_Adapter_Abstract

Tiger_Location_Adapter_Nominatim — OpenStreetMap geocoding (the free/zero-config default).

Backed by Nominatim (search + reverse). No API key, so signup autocomplete works out of the box for dev/demo. Two caveats to respect in production: the public instance is rate-limited (~1 req/s) and requires a descriptive User-Agent (both handled here) — for real traffic, self-host Nominatim or point endpoint at a hosted OSM provider (LocationIQ, Geoapify), or switch the address provider to AWS/Google/Mapbox.

Config: 'endpoint' (default https://nominatim.openstreetmap.org), 'email' (optional, added to requests per OSM policy for higher volume).

Methods

capabilities()

capabilities(): array

The CAP_* operations this adapter supports (suggest, geocode, reverse).

Returns array — a list of CAP_* capability constants

suggest()

suggest(string $query, array $opts = []): array

Autocomplete a partial address via Nominatim search.

  • $query string — the partial address text
  • $opts array — options (e.g. 'limit', 'country' to bias results)

Returns array — the suggestions

geocode()

geocode(string $query, array $opts = []): array

Geocode free text to structured place(s) via Nominatim search.

  • $query string — the address text to geocode
  • $opts array — options (e.g. 'limit', 'country' to bias results)

Returns array — the matches

reverse()

reverse(float $lat, float $lng, array $opts = []): ?Tiger_Location_Place

Reverse-geocode a coordinate to the nearest address via Nominatim.

  • $lat float — the latitude
  • $lng float — the longitude
  • $opts array — provider options

Returns ?Tiger_Location_Place — the nearest place, or null on no match