Road Trip Gas Station Finder

Road Trip Gas Station Finder

Plan your stops and find gas stations along your route.

Plan Your Route

Filter Options

Amenities: ${amenities || 'N/A'}

`; marker.bindPopup(popupContent); stationMarkers.push(marker); }); visibleStations = filteredStations; } function planRoute() { if (routeLine) { map.removeLayer(routeLine); } // Simulate a route between NY and LA const latlngs = [ [40.71, -74.00], [39.95, -75.16], [38.90, -77.03], [34.05, -118.24] ]; routeLine = L.polyline(latlngs, {color: 'purple', weight: 5, opacity: 0.7}).addTo(map); map.fitBounds(routeLine.getBounds().pad(0.1)); displayStations(); } function generatePdf() { const { jsPDF } = jspdf; const pdf = new jsPDF(); const start = document.getElementById('start-location').value; const end = document.getElementById('end-location').value; pdf.setFontSize(22); pdf.text(`Gas Station Route Plan`, 105, 20, { align: 'center' }); pdf.setFontSize(16); pdf.text(`${start} to ${end}`, 105, 30, { align: 'center' }); let y = 45; pdf.setFontSize(12); visibleStations.forEach((station, index) => { if (y > 270) { pdf.addPage(); y = 20; } const amenities = [ station.is_24_7 ? '24/7' : '', station.has_restrooms ? 'Restrooms' : '', station.has_ev_charging ? 'EV Charging' : '' ].filter(Boolean).join(', '); pdf.setFontSize(14); pdf.setTextColor(40, 40, 180); pdf.text(`${index + 1}. ${station.name} (${station.lat.toFixed(2)}, ${station.lng.toFixed(2)})`, 15, y); y += 7; pdf.setFontSize(11); pdf.setTextColor(50, 50, 50); pdf.text(`- Amenities: ${amenities || 'N/A'}`, 20, y); y += 10; }); pdf.save('gas-station-route-plan.pdf'); } document.getElementById('plan-route-btn').addEventListener('click', planRoute); document.querySelectorAll('.filter-cb').forEach(cb => cb.addEventListener('change', displayStations)); document.getElementById('pdf-download-btn').addEventListener('click', generatePdf); // Initial load planRoute(); });
Scroll to Top