Kartik Project Final1
Kartik Project Final1
ON
LIVE LOCATION TRACKER
Submitted By
Kartik Khatri (2221518)
This is to certify that the project titled “Live Location Tracker” submitted by
and Kartik Khatri (2221518) to Graphic Era Hill University, Department of
Bachelor of Computer Applications, is a genuine record of the work carried out
by them under my supervision.
The work described in this report has not been submitted for the award of any
other degree or diploma to any other institution. The project has been done
independently by the students with due guidance and assistance under my
supervision.
I have reviewed the content and progress of the project at every stage, and I
confirm that it is authentic and in line with academic standards.
I am deeply grateful to Ms. Sakshi Painuly, my project guide, whose guidance and
mentorship have been the cornerstone of this project. Her insights into the
complexities of real-time systems, particularly location tracking applications, have
inspired me to think critically and creatively about the problem at hand.
This project, titled "Live Location Tracker," would not have been possible
without her continuous encouragement and technical expertise. She helped me
break down the problem into smaller, manageable parts, making it easier to tackle
each phase systematically. Her feedback during the planning, implementation, and
testing phases ensured that the project met academic standards and practical
usability.
The primary goal of this project is to create a scalable and userfriendly platform
for sharing and viewing live locations. Unlike traditional methods of location
sharing, which often rely on static coordinates, the Live Location Tracker updates
locations dynamically. This ensures that users always have access to the most
accurate and up-to-date information.
1. Frontend:
3. APIs:
o The Geolocation API is used to fetch the latitude and longitude of
users in real time.
TABLE OF CONTENTS
1. ACKNOWLEDGEMENT
2. ABSTRACT
3. INTRODUCTION
3.1 What is Location Tracking?
3.2 Purpose and Scope of the Project
4. OBJECTIVE
4.1 Primary Objective
4.2 Specific Goals
5. REQUIREMENT ANALYSIS
5.1 System Requirements
5.2 Functional and Non-Functional Requirements
6. SYSTEM DESIGN
6.1 Architecture Overview
6.2 Frontend and Backend Design
7. TECHNOLOGIES USED
7.1 Frontend: EJS, CSS, Leaflet.js
7.2 Backend: Node.js, Socket.io, Geolocation API
8. IMPLEMENTATION
8.1 Frontend Implementation
8.2 Backend Implementation
8.3 Integration of Frontend and Backend
9. REFERENCES
10. APPENDIX
10.1 Source Code
10.2 Diagrams and Illustrations
10.3 User Guide
CHAPTER 3 : INTRODUCTION
The scope of the Live Location Tracker extends beyond simple location-sharing
applications. This system has potential use cases in various domains:
Primary Objective
The main goal of the Live Location Tracker is to create a robust and efficient
platform for tracking and sharing real-time geolocation information. The platform
is designed to be user-friendly, reliable, and adaptable for various applications.
Specific Objectives
4. Multi-User Support:
o Enable group tracking for applications like team coordination or
fleet management. o Implement user roles (e.g., admin, viewer) for
better access control.
Importance of Objectives
Hardware Requirements
o Minimum Configuration:
▪ 2 GB RAM
▪ Stable internet connection
Browser
o Recommended Configuration:
▪ 16GB RAM
▪ Quad-core processor
▪ High-speed SSD for better performance
Software Requirements
The functional requirements define the essential capabilities of the Live Location
Tracker:
1. User Authentication: Ensure only authorized users can access the system.
4. Map Features:
o Add markers for users’ current positions.
o Draw routes based on movement history.
1. Performance:
o Handle up to 10,000 concurrent users without noticeable lag.
o Update location data in less than 500 milliseconds.
2. Security:
o Encrypt sensitive user data using AES encryption.
o Use secure communication protocols like HTTPS.
3. Scalability:
o Support additional features like geofencing or indoor navigation in
the future.
o Handle increased traffic during peak usage times.
CHAPTER 6 : SYSTEM DESIGN
System design involves planning the overall structure and workflow of the
application to ensure efficiency, scalability, and ease of use.
1. The client-side handles user input, location fetching, and displaying data.
2. Leaflet.js:
o Display interactive maps with features like zoom, layers, and pop-
ups.
Frontend Technologies
2. Leaflet.js
Backend Technologies
1. Node.js
• Cross-platform compatibility.
3. Geolocation API
The Geolocation API enables web applications to access the user’s geographical
location.
Integration of Technologies
The technologies used in the Live Location Tracker are seamlessly integrated to
ensure a cohesive system:
1. Frontend-Backend Communication:
2. Map Rendering:
3. Data Flow:
Frontend Implementation
EJS templates generate dynamic web pages based on user input and backend data.
For example:
• The Home Page displays a map with markers for active users.
EJS Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Tracking App</title>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.css"
integrity="sha512-
h9FcoyWjHcOcmEVkxOfTLnmZFWIH0iZhZT1H2TbOq55xssQGEJHEaI
m+PgoUaZbRvQTNTluNOEfb1ZRy6D3BOw=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<!-- Your body content goes here -->
<!-- Map container -->
<div id="map"></div>
<script src="https://cdn.socket.io/4.8.1/socket.io.min.js"
integrity="sha384-
mkQ3/7FUtcGyoppY6bz/PORYoGqOl7/aSUMn2ymDOJcapfS6PHqxhRT
Mh1RR0Q6+" crossorigin="anonymous"></script>
<script src="/js/script.js"></script>
</body>
</html>
CSS Code:
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
width: 100%;
height: 100%;
}
Script.js Code:
if (navigator.geolocation) {
navigator.geolocation.watchPosition(
(position) => {
const { latitude, longitude } = position.coords;
socket.emit("send-location", { latitude, longitude });
},
(error) => {
console.error(error);
},
{
enableHighAccuracy: true,
maximumAge: 0,
timeout: 5000
}
);
}
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: '© <a
href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>
contributors',
}).addTo(map);
if (markers[id]) {
// Update the existing marker's position
markers[id].setLatLng(markerPosition);
} else {
// Add a new marker if it doesn't exist
markers[id] = L.marker(markerPosition).addTo(map);
}
});
App.js Code:
const io = socketio(server);
The backend broadcasts the location data to all connected clients, ensuring real-
time updates on the map.
Screenshots and Illustrations:
CHAPTER 9 : REFERENCES