Quickstart
From zero to a working geocoding + routing integration. Pick your language; the cURL section works regardless.
1. Get an API key
Sign up at /signup. After verifying your email, your dashboard will show one map_live_… key. Copy it now — you won't see the full value again.
For dev work against a local gateway, use the baked-in test_dev_key_dev_only_12345 key.
2. Make your first call (cURL)
Geocode a Banglish query — note how bdnlp normalises "Gulshon" → Gulshan and returns the canonical Bangla label.
curl -sS "https://api.map.bd/v1/geocode/search?q=Gulshon&limit=3" \ -H "Authorization: Bearer map_live_..."
{
"_map_parsed": { "Locality": "Gulshan", "Normalized": "Gulshan, Bangladesh", ... },
"_map_variants_tried": ["Gulshan, Bangladesh", "Gulshon"],
"results": [
{
"display_name": "গুলশান, ঢাকা, বাংলাদেশ",
"lat": "23.79217", "lon": "90.41555",
"_map_score": 1
}
]
}3. Same call from your language
TypeScript / JavaScript
// npm i @map-bd/sdk
import { MapClient } from "@map-bd/sdk";
const client = new MapClient({ apiKey: process.env.MAP_API_KEY! });
const r = await client.geocode.search({ q: "Gulshon", limit: 3 });
console.log(r.results?.[0]?.display_name);Python
# pip install map-bd
from map_bd import MapClient
client = MapClient(api_key=os.environ["MAP_API_KEY"])
r = client.geocode_search("Gulshon", limit=3)
print(r["results"][0]["display_name"])Go
// go get github.com/map-bd/sdk-go
import mapbd "github.com/map-bd/sdk-go"
c := mapbd.New(os.Getenv("MAP_API_KEY"))
r, err := c.GeocodeSearch(ctx, mapbd.GeocodeSearchParams{Q: "Gulshon", Limit: 3})
fmt.Println(r.Results[0].DisplayName)4. Get directions between two points
const trip = await client.directions({
locations: [
{ lat: 23.7925, lon: 90.4078 }, // Banani
{ lat: 23.7330, lon: 90.4172 }, // Old Dhaka
],
});
console.log(trip.trip.summary); // { length: km, time: seconds }
console.log(trip.trip.legs[0].maneuvers[0].instruction);
// "Drive east on সড়ক ১৭/এ..."The shape field is a polyline-6 string — decode it for MapLibre rendering:
import { decodePolyline6 } from "@map-bd/sdk";
const points = decodePolyline6(trip.trip.legs[0].shape);
// → [{lat: 23.79, lon: 90.40}, ...]5. Render a map
Use any MapLibre-compatible client. Our vector tile URL takes the API key as a query param so map clients (which can't set custom headers) work out of the box.
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5/dist/maplibre-gl.css">
<script src="https://unpkg.com/maplibre-gl@5/dist/maplibre-gl.js"></script>
<script>
const map = new maplibregl.Map({
container: 'map',
style: {
version: 8,
sources: {
bd: {
type: 'vector',
tiles: ['https://api.map.bd/v1/tiles/bangladesh/{z}/{x}/{y}?api_key=map_live_...'],
minzoom: 0, maxzoom: 14,
}
},
layers: [/* …your style layers, or grab one from /style/positron.json… */]
},
center: [90.4125, 23.8103],
zoom: 11,
});
</script>What's next
- Concepts — understand bdnlp, costing, webhooks, rate limits
- Build a dispatch app — full 60-minute walkthrough
- Playground — try queries interactively
- API reference — every endpoint, every parameter