Geocoding Routes
RESTful API endpoints for address-to-coordinate (forward) and coordinate-to-address (reverse) geocoding using Nominatim (OpenStreetMap).
Base Path
/api/geocoding
Endpoints Summary
| Method | Endpoint | Description |
|---|---|---|
| GET | /forward | Address to coordinates |
| GET | /reverse | Coordinates to address |
| GET | /search | Search locations |
| GET | /autocomplete | Address autocomplete |
Endpoints
GET /api/geocoding/forward
Convert address to coordinates (forward geocoding).
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
address | string | Yes | Address to geocode |
limit | number | No | Max results (default: 5) |
bounds | string | No | Bounding box filter |
Response:
{
"success": true,
"data": [
{
"displayName": "123 Nguyen Hue, Ben Nghe, District 1, Ho Chi Minh City",
"latitude": 10.7731,
"longitude": 106.7030,
"type": "building",
"confidence": 0.92,
"boundingBox": [10.772, 106.702, 10.774, 106.704]
}
]
}
GET /api/geocoding/reverse
Convert coordinates to address (reverse geocoding).
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
lat | number | Yes | Latitude |
lon | number | Yes | Longitude |
zoom | number | No | Detail level (0-18) |
Response:
{
"success": true,
"data": {
"displayName": "123 Nguyen Hue, Ben Nghe, District 1, Ho Chi Minh City, Vietnam",
"address": {
"houseNumber": "123",
"road": "Nguyen Hue",
"suburb": "Ben Nghe",
"district": "District 1",
"city": "Ho Chi Minh City",
"country": "Vietnam",
"postcode": "700000"
},
"latitude": 10.7731,
"longitude": 106.7030
}
}
GET /api/geocoding/autocomplete
Get address suggestions while typing.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Partial address query |
limit | number | No | Max suggestions (default: 5) |
Response:
{
"success": true,
"data": [
{
"displayName": "Nguyen Hue Street, District 1",
"latitude": 10.7731,
"longitude": 106.7030
},
{
"displayName": "Nguyen Hue Walking Street",
"latitude": 10.7750,
"longitude": 106.7045
}
]
}
Related Documentation
- Routing Routes - Navigation
- Camera Routes - Location-based queries