Skip to content

Geocoding City Bounds

Get city location and bounding box information using OpenStreetMap Nominatim geocoding service. Public endpoint.

Endpoint

GET /v1/accounts/geocoding/city-bounds/

Authentication

Not required (public endpoint)

Query Parameters

Parameter Type Required Description
city string Yes City name
country string No Country name (optional, helps narrow down results)

Response

Success (200 OK)

Returns city location and bounding box information:

{
  "lat": "40.37",
  "lon": "49.84",
  "display_name": "Baku, Azerbaijan",
  "boundingbox": ["40.365", "40.375", "49.835", "49.845"]
}

Response Fields: - lat: Latitude of the city center - lon: Longitude of the city center - display_name: Full display name of the location - boundingbox: Array of 4 values [min_lat, max_lat, min_lon, max_lon] defining the city boundaries

Error Responses

Bad Request (400)

{
  "error": "Query parameter 'city' is required"
}

Not Found (404)

{
  "error": "City not found"
}

Internal Server Error (500)

{
  "error": "Failed to fetch from geocoding service"
}

or

{
  "error": "Failed to read response"
}

or

{
  "error": "Failed to parse response"
}

Example Request

curl -X GET "https://api.luxmart.site/v1/accounts/geocoding/city-bounds/?city=Baku&country=Azerbaijan"

Notes

  • This endpoint proxies requests to OpenStreetMap Nominatim geocoding service
  • The city parameter is required
  • The country parameter is optional but recommended to narrow down results for cities with common names
  • Returns the first matching result
  • The bounding box can be used to limit map viewport to the city area
  • This is a public endpoint, no authentication required
  • The service uses a 10-second timeout for external requests