A robust backend API service that converts latitude and longitude coordinates into human-readable addresses using the Nominatim OpenStreetMap service.
- Reverse Geocoding: Get a single-line address from coordinates.
- Validation: Strict input validation for latitude and longitude.
- Error Handling: Comprehensive error messages for invalid input, API failures, and empty results.
- Premium UI: A modern, interactive dashboard to test the API.
Converts coordinates to a human-readable address.
-
Endpoint:
/api/reverse-geocode -
Method:
GET -
Parameters:
lat(required): Latitude (e.g.,22.596066)lon(required): Longitude (e.g.,76.905841)
-
Success Response (200 OK):
{ "status": "success", "data": { "address": "NH47, Khategaon, Khategaon Tahsil, Dewas, Madhya Pradesh, India", "raw": { ... } } } -
Error Response (400 Bad Request):
{ "status": "error", "message": "Invalid coordinate format. Latitude and Longitude must be numbers." }
- Node.js (v18 or higher recommended)
- Clone the repository or extract the files.
- Run
npm installto install dependencies.
npm startThe server will be available at http://localhost:3000.
npm run dev- Backend: Node.js, Express.js
- HTTP Client: node-fetch
- Frontend: HTML5, Vanilla CSS (Premium Dark Theme)
- Geocoding: OpenStreetMap Nominatim API