REST API

Search, place details and directions are plain HTTPS calls, for your servers or any language. Use a secret key in the Authorization header. Responses are JSON; errors are described in API keys, limits and errors.

curl "https://api.maps.milsat.africa/v1/search?q=yaba%20market&near=3.38,6.52" \
  -H "Authorization: Bearer sk_live_…"

Positions in the REST API are lng,lat in query strings and [lng, lat] in responses, as in GeoJSON. MilsatMaps covers Nigeria: a point elsewhere (in near, reverse lookup or directions) answers 422 invalid, and the message says so if it looks like lat,lng sent the wrong way round. Send Accept-Encoding: gzip and responses come compressed; most HTTP clients do this for you. Search results and places name their source origin; the SDK calls it source.

Parameter
qRequired. Up to 120 characters.
nearlng,lat: prefer matches near here.
limit1 to 20. Default 8.
{
  "results": [
    {
      "id": "osm.n501540907",
      "origin": "osm",
      "name": "Ikeja",
      "category": "city",
      "kind": "place",
      "context": "Ikeja, Lagos",
      "location": [3.3516, 6.6016],
      "score": 0.97
    }
  ]
}

GET /v1/places/{id}

A place in full, by the id from a search result: a search result's fields plus geometry (GeoJSON), attributes (the place's raw tags), verified (checked on the ground by MilsatMaps), contact and photos (read from the attributes, ready to show), and for MilsatMaps' own places updated_at. Unknown ids answer 404 not_found.

{
  "id": "osm.n501540907",
  "origin": "osm",
  "name": "Ikeja",
  "category": "city",
  "kind": "place",
  "context": "Ikeja, Lagos",
  "location": [3.3515981, 6.601627],
  "geometry": { "type": "Point", "coordinates": [3.351598, 6.601627] },
  "attributes": { "population": "861300" },
  "verified": false,
  "contact": {},
  "photos": []
}

GET /v1/reverse?lng=…&lat=…

What is at a point: label (one line, ready to show), place (a search result, or null), street, context, location and postcode (or null).

{
  "label": "Sample Pharmacy (Yaba Central), Shomolu, Lagos",
  "place": {
    "id": "ml.00000000-0000-4000-8000-000000000101",
    "origin": "milsat",
    "name": "Sample Pharmacy (Yaba Central)",
    "category": "pharmacy",
    "kind": "poi",
    "context": "Shomolu, Lagos",
    "location": [3.3792, 6.5244]
  },
  "street": "Eletu Odibo Street",
  "context": "Shomolu, Lagos",
  "location": [3.3792, 6.5244],
  "postcode": null
}

GET /v1/route

Parameter
fromRequired. lng,lat.
toRequired. lng,lat.
modedriving (default) or walking.
overviewfull (default), simplified (fewer points, for an overview map) or false (no geometry: just distance, time and steps).

Answers distance_m, duration_s (without traffic), geometry (a GeoJSON LineString) and steps, each with instruction, name, distance_m, duration_s, location and sign.

{
  "mode": "driving",
  "distance_m": 13736.8,
  "duration_s": 904.4,
  "geometry": { "type": "LineString", "coordinates": [[3.380202, 6.520116], [3.380094, 6.520301], …] },
  "steps": [
    { "instruction": "Start: drive on Ebun Street", "name": "Ebun Street", "distance_m": 132.3,
      "duration_s": 26.7, "location": [3.380202, 6.520116], "sign": "depart" },
    { "instruction": "Turn left onto Aggrey Avenue", "name": "Aggrey Avenue", "distance_m": 772,
      "duration_s": 69.9, "location": [3.379728, 6.521212], "sign": "left" },
    …
  ]
}

Both points must be in Nigeria and within 2 km of a road. A point outside Nigeria answers 422 invalid, and says so if it looks like lat,lng sent the wrong way round; a point far from any road answers 404 no_route. If walking directions aren't offered where you call from, mode=walking answers 503 mode_unavailable.

GET /v1/features/{id}

The attributes of one of MilsatMaps' own map features (a building, road or area drawn in the MilsatMaps layer), by the id the map reports when it is clicked. This is the Feature details service on a key; the SDK uses it to show what was clicked. Answers id, kind, layer, category, name, attributes, osm_ref (the matching OpenStreetMap object, if any), geometry (GeoJSON) and updated_at. Unknown ids answer 404 not_found.

Maps and map loads

MilsatMaps' own layer is served as vector tiles behind short-lived tokens bound to your key and site. The SDK fetches and refreshes them for you; use the SDK to show the map rather than requesting tiles yourself. Each new token is one map load; the SDK renews it free while the map stays open, and the tiles themselves aren't counted.