Skip to content

thehp23/Task2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoCoder Pro - Reverse Geocoding API

A robust backend API service that converts latitude and longitude coordinates into human-readable addresses using the Nominatim OpenStreetMap service.

Features

  • 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.

API Documentation

Reverse Geocode

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."
    }

Getting Started

Prerequisites

  • Node.js (v18 or higher recommended)

Installation

  1. Clone the repository or extract the files.
  2. Run npm install to install dependencies.

Running the Server

npm start

The server will be available at http://localhost:3000.

Development Mode

npm run dev

Technologies Used

  • Backend: Node.js, Express.js
  • HTTP Client: node-fetch
  • Frontend: HTML5, Vanilla CSS (Premium Dark Theme)
  • Geocoding: OpenStreetMap Nominatim API

About

A robust backend API service that converts latitude and longitude coordinates into human-readable addresses using the Nominatim OpenStreetMap service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors