@unmap/geocoding
v0.10.0
Published
Typed client for the unmap geocoding API
Maintainers
Readme
@unmap/geocoding
Typed client for the unmap geocoding API: full-text search, type-ahead autocomplete, category search, and reverse lookup over Canadian addresses and places, with English, French, and Indigenous-language names on the same record. No map dependency; works in Node and the browser.
npm i @unmap/geocodingimport { Geocoder } from '@unmap/geocoding'
const geocoder = new Geocoder({ key: 'um_live_...' })
await geocoder.search('Château Frontenac', { lang: 'fr', limit: 5 })
await geocoder.autocomplete('rue sainte-cath', { lang: 'fr' })
await geocoder.nearby('pharmacy', { near: [-114.07, 51.05], radius: 2000 })
await geocoder.reverse(-68.517, 63.749)Every method resolves to a GeocodeResult[]: id, name, layer, lng, lat, plus score
(search and autocomplete), distance in metres and category (nearby), names when the record
carries language-keyed labels, and a structured address when one exists.
search and autocomplete take { limit, lang, bbox, signal }; nearby takes exactly one of
near: [lng, lat] or bbox, plus { radius, limit, lang, signal }; reverse takes
{ lang, signal }. category accepts taxonomy ids (health.pharmacy) or plain English or
French words (pharmacy, pharmacie), one at a time or up to eight as an array. A non-2xx
response throws a GeocoderError carrying the HTTP status.
Parameters, defaults, the category list, and error bodies are documented at unmap.dev/docs/geocoding-api.
