Skip to content

khatriharsh08/photo-location-finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Έ Photo Location Finder

Next.js React FastAPI License


πŸ“ Description

Photo Location Finder is a full-stack web application built with Next.js, React, and FastAPI that helps you pinpoint the exact geographical location where a photo was taken.

Upload a photo, and the app extracts GPS coordinates (latitude and longitude) embedded in the image’s EXIF metadata. Instantly visualize the location on Google Maps and explore your captured memories in a new way.


✨ Features

  • 🌍 Extract GPS data (latitude & longitude) from photos
  • 🧭 Automatic conversion from DMS to decimal coordinates
  • πŸ—ΊοΈ Google Maps link to visualize photo locations
  • πŸ’» Fast and efficient API built with FastAPI
  • ⚑ Modern frontend with Next.js and React
  • πŸ”’ CORS-enabled secure backend communication

πŸ› οΈ Tech Stack

Frontend:

  • βš›οΈ React
  • πŸ•ΈοΈ Next.js

Backend:

  • ⚑ FastAPI
  • 🐍 Python

πŸ“¦ Key Dependencies

Frontend:
axios: ^1.10.0
framer-motion: ^12.23.12
gsap: ^3.13.0
lucide-react: ^0.539.0
next: 15.4.1
react: 19.1.0
react-dom: 19.1.0

Backend:
fastapi: ^0.115.0
uvicorn: ^0.30.0
piexif: ^1.1.3

πŸš€ Run Commands

Frontend

  • Development: npm run dev
  • Build: npm run build
  • Start: npm run start
  • Lint: npm run lint

Backend

  • Run Server:

    uvicorn backend.main:app --reload

    By default, the FastAPI backend runs on http://localhost:8000


πŸ“ Project Structure

.
β”œβ”€β”€ LICENSE
β”œβ”€β”€ backend
β”‚   β”œβ”€β”€ main.py                # FastAPI backend for GPS extraction
β”‚   └── requirements.txt
└── frontend
    β”œβ”€β”€ app
    β”‚   β”œβ”€β”€ components
    β”‚   β”‚   β”œβ”€β”€ ImageUploader.jsx
    β”‚   β”‚   └── LocationResult.jsx
    β”‚   β”œβ”€β”€ globals.css
    β”‚   β”œβ”€β”€ layout.js
    β”‚   └── page.js
    β”œβ”€β”€ jsconfig.json
    β”œβ”€β”€ next.config.mjs
    β”œβ”€β”€ package.json
    β”œβ”€β”€ postcss.config.mjs
    └── public
        β”œβ”€β”€ file.svg
        β”œβ”€β”€ globe.svg
        β”œβ”€β”€ next.svg
        β”œβ”€β”€ vercel.svg
        └── window.svg

🧠 Backend Overview (backend/main.py)

The backend is a FastAPI service that handles photo uploads and extracts GPS EXIF metadata.

πŸ”§ Key Features

  • Validates image file type (.jpg, .jpeg)

  • Enforces a 5MB file size limit

  • Extracts and converts GPS EXIF tags (latitude/longitude)

  • Returns:

    • latitude
    • longitude
    • A direct Google Maps link

🧩 API Endpoint

POST /upload β€” Upload image and extract GPS data

Example Response:

{
  "latitude": 40.748817,
  "longitude": -73.985428,
  "map_link": "https://www.google.com/maps?q=40.748817,-73.985428"
}

Example Error Responses:

  • 400: Invalid file type or corrupted image
  • 404: No GPS data found in EXIF
  • 413: File too large

πŸ› οΈ Development Setup

1️⃣ Backend Setup

  1. Navigate to the backend folder

    cd backend
  2. Create and activate a virtual environment

    python -m venv venv
    source venv/bin/activate  # macOS/Linux
    venv\Scripts\activate     # Windows
  3. Install dependencies

    pip install fastapi uvicorn piexif
  4. Run FastAPI server

    uvicorn main:app --reload

2️⃣ Frontend Setup

  1. Navigate to the frontend folder

    cd frontend
  2. Install dependencies

    npm install
  3. Run development server

    npm run dev
  4. Access frontend: πŸ‘‰ http://localhost:3000


πŸ”— Connecting Frontend & Backend

Make sure CORS in main.py allows your frontend origin:

allow_origins=["http://localhost:3000"]

When deploying, replace it with your production domain.


πŸ‘₯ Contributing

Contributions are welcome!

  1. Fork the repository

  2. Clone your fork

    git clone https://github.com/khatriharsh08/photo-location-finder.git
  3. Create a feature branch

    git checkout -b feature/your-feature
  4. Commit your changes

    git commit -m "Add some feature"
  5. Push to your branch

    git push origin feature/your-feature
  6. Open a Pull Request


πŸ“œ License

This project is licensed under the MIT License.


πŸ–ΌοΈ Demo Images

Geo Location 1 Geo Location 2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors