TMaps - Mapping API Tunisia

Reverse geocoding

Convert a pair of GPS coordinates into a readable postal address (street, commune, delegation, governorate).

The Reverse Geocoding endpoint takes a lat / lng pair and returns the matching postal address with its administrative breakdown (commune, delegation, governorate).

Endpoint

GET https://api.tmaps.tn/geocoding/reverse?lat=...&lng=...&api_key=YOUR_API_KEY

Parameters

Query parameters

Param Type Requis Défaut Description
lat number oui WGS84 latitude in decimal degrees (between -90 and 90).
lng number oui WGS84 longitude in decimal degrees (between -180 and 180).
api_key string oui Your TMaps API key.
lang string fr Language for the formatted address: fr, en or ar.
type string Target type: address, street, poi, locality. Useful to force a locality result when you only want the commune.
limit integer 1 Maximum number of results (1 → 5).

Sample request

curl "https://api.tmaps.tn/geocoding/reverse?lat=36.8002&lng=10.1815&lang=en&api_key=YOUR_API_KEY"

Response

200 Coordinates resolved into an address
{
"query": { "lat": 36.8002, "lng": 10.1815 },
"results": [
  {
    "lat": 36.8002,
    "lng": 10.1815,
    "formatted": "Avenue Habib Bourguiba, 1001 Tunis, Tunisia",
    "distance": 4.2,
    "type": "address",
    "components": {
      "street": "Avenue Habib Bourguiba",
      "postcode": "1001",
      "commune": "Tunis",
      "delegation": "Tunis Médina",
      "governorate": "Tunis",
      "country": "TN"
    }
  }
]
}

Returned fields

Result fields

Param Type Requis Défaut Description
lat number Latitude of the matched point (may differ from the request if snapped to an object).
lng number Longitude of the matched point.
formatted string Full formatted address.
distance number Distance in meters between the request and the matched point.
type string Result type: address, street, poi, locality.
components object Administrative breakdown: street, postcode, commune, delegation, governorate, country.

Snap to nearest street or building

If the input coordinate falls in the middle of a street or 30 m from a building, the API returns the nearest relevant point and exposes the distance via distance.

Use cases

  • Mobile apps: display the postal address of the user’s GPS position.
  • Inspection tours: associate each field GPS point with a cadastral address.
  • Logs and audits: enrich raw coordinates with administrative context.

Errors

StatusCause
400Missing lat/lng or out of range
401Missing or revoked api_key
403Domain not authorized
404No address found nearby

See Error codes for the full list.