Finding the closest metro station in Dhaka was a real headache. Every time someone asked, "Where's the nearest metro station to where I'm going?" I had to dig through maps, trying to figure it out. It was a slow and annoying process because Google Maps still needed to show metro stations. That's when I thought of a better way. I created the Metro Station Finder, a simple app made with Next.js. It makes my life easier by quickly showing the closest metro station and how far it is just by entering a location. No more map headaches!
- Search functionality to input a location.
- Interactive map view to display user's location and nearest metro station.
- Distance calculation from the user's location to the nearest metro station.
- Fare calculation between two stations.
Enter a location in the search bar and click the 'Search' button. The map will update to show your location and the nearest metro station, along with the distance to it.
metro-station-finder/
βββ src/
β βββ components/
β β βββ CustomDropdown.tsx // Custom component for the dropdown on route fare.
β β βββ Layout.tsx // Header and footer component for the website.
β β βββ mapview.tsx // Component for displaying the map view.
β β βββ metroInfoCard.tsx // Component for displaying metro station info card.
β β βββ NavBar.tsx // Nav bar design for the website.
β β βββ Searchbar.tsx // Component for the search bar.
β
βββ pages/
β βββ _app.tsx // Main Next.js application component.
β βββ index.tsx // Homepage of the application.
β βββ route-fare.tsx // Route fare page layout.
β
βββ services/
β βββ fareCalculation.ts // Service for fetching route fare data.
β βββ metroService.ts // Service for fetching metro station data.
β
βββ styles/
β βββ globals.css // Global CSS styles.
β
βββ utils/
β βββ constants.ts // Metro stations map location.
β βββ loadGoogleMapScript.ts // Utility for loading Google Maps scripts.
- Clone the repository:
git clone https://github.com/tashfiqul-islam/metro-station-finder.git
- Navigate to the project directory:
cd metro-station-finder
- Install dependencies:
npm install
- Set up the environment variables:
Create a.env.local
file in the root directory and add your Google Maps API key:
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_api_key
To start the development server, run:
Navigate to http://localhost:3000 to view the application.
npm run dev
Contributions to the Metro Station Finder are welcome. Please reach out to me if you've more ideas for this.
Licensed under the MIT License.
Feel free to use and modify as you like.
This project was a learning journey, crafted with β€οΈ by Tashfiq.
A stepping stone in my ongoing quest to become a Programming Ninja!
π Follow me on GitHub β I promise, my future projects will only have slightly fewer bugs! π