English | 繁體中文版
A unified web-based map dashboard designed for Taiwanese commuters and car-sharing users. This project consolidates, cleans, and visualizes geospatial data from Taiwan's top 3 roadside car-sharing platforms (iRent, GoSmart, URiDE), integrates public transportation networks (Taipei MRT lines/stations), and calculates cross-brand proximity hubs to enable seamless multi-modal transit and platform transfers.
- Displays iRent Relocation Lots, GoSmart Hubs, and URiDE Stations in a single, responsive Leaflet map, eliminating the need to toggle between different vendor apps.
- Features custom pulsating markers with distinct brand colors: Red (iRent), Blue (GoSmart), and Yellow (URiDE).
- Computes real-world spherical distances (Haversine formula) between different platforms. Stations within 200 meters (approx. 2-minute walk) are automatically connected with glowing purple dashed lines and detailed proximity tables in Popups.
- This helps users perform fast cross-brand transfers (e.g., dropping off an iRent and immediately renting a nearby URiDE).
- Includes static layers of Taipei MRT routes and stations.
- MRT layers are non-interactive (
interactive: falseandpointer-events: none) to serve as a clean visual background, avoiding interference with clickable car-sharing pins.
- Fully compliant with PWA specifications. Users can add the map as a standalone app on iOS Safari ("Add to Home Screen") or Android Chrome.
- Runs in
standalonedisplay mode (no URL bar, full-screen, immersive feel). - Utilizes a Service Worker (
sw.js) to cache static resources and map tiles, enabling fast, offline-capable load times even with poor roadside signals.
- Features a custom pulsating GPS button at the bottom center.
- Pinpoints the user's location with a glowing sky-blue ripple marker and automatically flies the camera to the closest available rental station across all active platforms.
- Popup dialogs contain a "Rent Now" action button that attempts to wake the corresponding rental app on the user's mobile device via custom URL Schemes (
easyrent://,gosmart://,uride://). - Fallbacks gracefully to App Store (iOS) or Google Play (Android) listings in under 1.5 seconds if the app is not installed.
- Front-End:
- Semantic HTML5
- Vanilla CSS3 (custom HSL variables, frosted-glass Glassmorphism panel styling, flexbox/grid responsive layouts)
- Vanilla ES6+ JS (parallel async fetches, modular filters, event bindings)
- Maps & Geospatial:
- Leaflet.js (Self-hosted to prevent CDN outages)
- Leaflet.markercluster (High-performance marker clustering)
- Mathematical Haversine calculations.
- Vector cutout clipping masks (Even-Odd winding rule) to dim non-operating regions.
- PWA & Caching:
- Service Worker API (
Stale-While-RevalidateandCache-Firststrategies) - Web App Manifest (
manifest.json)
- Service Worker API (
- Fonts & Icons:
- FontAwesome 6.x
- Google Fonts (Orbit, Outfit, Inter)
taiwan-carsharing-map/
├── data/
│ ├── irent_stations.json # iRent roadside relocation station data
│ ├── gosmart_stations.json # GoSmart hub station data
│ ├── uride_stations.json # URiDE station data
│ ├── zones.json # Operating area polygons
│ ├── metro_lines.json # Taipei MRT route geometries
│ └── metro_stations.json # Taipei MRT station coordinates
├── lib/ # Local Leaflet & MarkerCluster assets
├── index.html # Main HTML entry point
├── app.css # Glowing dark theme and glassmorphism panel styles
├── app.js # Core rendering, distance sorting, and PWA logic
├── sw.js # PWA caching worker
├── manifest.json # Web App Manifest descriptors
├── icon-192.png / icon-512.png # PWA application icons
└── README.md # Main documentation (English)
Since the application uses PWA features and ES modules, it cannot be run by double-clicking the .html file. You need a local server:
-
Clone the repository:
git clone https://github.com/ASDXDXD630/twrentacar.git cd twrentacar -
Launch a lightweight web server:
- Python (Recommended):
python -m http.server 8000
- Node.js:
npm install -g http-server http-server -p 8000
- Python (Recommended):
-
Open the browser:
- Navigate to
http://localhost:8000to inspect the dashboard. - Access via your computer's local IP (e.g.,
http://192.168.1.100:8000) on your mobile phone on the same Wi-Fi network to test mobile GPS tracking and PWA app installation.
- Navigate to
Contributions are highly welcome!
- To update operating boundaries, modify
data/zones.json. - To update car-sharing hubs, update the respective
.jsonfiles inside thedata/folder.
This project is licensed under the MIT License. Feel free to modify and share.