Skip to main content
The JavaScript client wraps the Baato API in a fluent builder, decodes route geometry for you, and works both as an npm package and as a standalone browser bundle.

npm

@klltech/baato-js-client

Runnable examples

Complete HTML pages using the bundle.

Installation

The CDN bundle exposes a global Baato object — no build step required. That is what the HTML examples use.

Usage

Every service follows the same shape: construct, chain setters, call doRequest(), get a promise back.

Search — place suggestions

Search results carry no coordinates — pass a result’s placeId to Baato.Places() to get them. See the two-step search flow.
setCoordinates takes [latitude, longitude] — the opposite order from the [lng, lat] arrays MapLibre and Mapbox GL use. See coordinate order.
Routing results arrive with the encoded polyline already decoded — each route carries a ready-to-render geojson property, so you can hand it straight to a map source.

Converting results to GeoJSON

Baato.Util() turns a search response into a GeoJSON FeatureCollection:

Next

Display a map

A complete page with MapLibre and Mapbox GL.

Autocomplete

A working search box wired to the client.