7.8 KiB
Geolocation Troubleshooting Guide
Overview
This guide helps resolve issues with the "Find Nearby" fuel station search feature that uses your device's location to find nearby gas stations.
Quick Fixes
1. Check Browser Permissions
Firefox:
- Click the shield/lock icon in the address bar
- Make sure "Location" is set to "Allow"
- If it shows "Blocked", click it and select "Allow"
- Refresh the page and try again
Chrome:
- Click the lock icon next to the URL
- Set "Location" to "Allow"
- Refresh the page
Safari:
- Go to Safari > Preferences > Websites > Location Services
- Find your site and set it to "Allow"
2. Enable Location Services (System Level)
Windows 10/11:
- Settings > Privacy & Security > Location
- Turn on "Location services"
- Turn on "Allow apps to access your location"
macOS:
- System Preferences > Security & Privacy > Privacy
- Select "Location Services"
- Enable Location Services
- Check the box for your browser
Linux:
- Settings > Privacy > Location Services
- Enable Location Services
Common Issues and Solutions
Issue: "Location access was denied"
Cause: Browser permission blocked Solution:
- Clear site permissions and try again
- Check if location services are enabled system-wide
- Try in incognito/private browsing mode
- Check if browser has location permission in OS settings
Issue: "Location information is unavailable"
Cause: GPS/location services disabled or poor signal Solutions:
- Enable GPS on mobile devices
- Move to an area with better signal (away from buildings)
- Wait a few moments for GPS to get a fix
- Try refreshing the page
- Use Wi-Fi instead of mobile data (often more accurate)
Issue: "Location request timed out"
Cause: Taking too long to get GPS fix Solutions:
- Wait longer - GPS can take 30+ seconds for first fix
- Move outside or near a window
- The app will automatically retry with lower accuracy
- Use manual entry as backup
Issue: "This page requires HTTPS"
Cause: Modern browsers require secure connection for location access Solutions:
- Access the site via
https://instead ofhttp:// - If running locally, use
localhostinstead of IP address - Contact administrator to enable HTTPS
Browser-Specific Issues
Firefox
- Private Browsing: Location might be blocked by default
- Enhanced Tracking Protection: May interfere with location
- Solution: Temporarily disable tracking protection for the site
Chrome
- Incognito Mode: Location access requires explicit permission
- Site Settings: Check chrome://settings/content/location
- Solution: Ensure site is not in "Block" list
Safari
- Privacy Settings: May block location by default
- Website Settings: Check per-site permissions
- Solution: Enable in Safari preferences
Mobile Browsers
- App Permissions: Browser app needs location permission
- Battery Saving: May disable GPS
- Solution: Check app permissions in device settings
Debugging Steps
1. Check Browser Console
- Press F12 to open developer tools
- Go to Console tab
- Click "Find Nearby" and look for error messages
- Common errors and meanings:
User denied geolocation→ Permission issuePosition unavailable→ GPS/signal issueTimeout→ Taking too long to get location
2. Test Geolocation Manually
- Open browser console (F12)
- Type:
navigator.geolocation.getCurrentPosition(console.log, console.error) - Check if you get coordinates or an error
3. Check Permissions API
- In console, type:
navigator.permissions.query({name: 'geolocation'}) - Should return permission state: 'granted', 'denied', or 'prompt'
4. Verify HTTPS
- Check if URL starts with
https:// - Look for lock icon in address bar
- Geolocation requires secure context
Alternative Solutions
1. Manual Entry
- Click "Enter Station Details Manually" in the search modal
- Fill in station name and address yourself
- Useful when location services fail
2. Use Map Applications
- Search for "gas stations near me" in Google Maps
- Copy station name and address to TankStopp manually
- More reliable but requires extra steps
3. Search by City/Area
- Enter your city name in the location field
- Add station name from memory or other sources
- Good for frequently visited stations
Technical Details
Geolocation Requirements
- HTTPS: Required for security (except localhost)
- User Permission: Must be explicitly granted
- Active Connection: Internet required for map data
- GPS/Network: Device needs location capability
How It Works
- Request Location: Browser asks device for coordinates
- Get Permission: User must allow location access
- Query Map Data: Searches OpenStreetMap for fuel stations
- Calculate Distance: Sorts results by proximity
- Display Results: Shows stations with distance
Accuracy Factors
- GPS Signal: Better outdoors with clear sky
- Wi-Fi Location: More accurate in urban areas
- Mobile Network: Less accurate but faster
- Device Type: Phones generally more accurate than laptops
Advanced Troubleshooting
Clear Browser Data
- Clear cookies and site data for the website
- Reset all permissions
- Try accessing the site fresh
Network Issues
- Firewall: May block map API requests
- VPN: Can affect location accuracy
- Corporate Network: May have restrictions
Device Issues
- Low Battery: May disable GPS
- Airplane Mode: Disables all location services
- Location History: Some devices need this enabled
Getting Help
Collect Debug Information
If you're still having issues, collect this information:
- Browser name and version
- Operating system
- Error messages from browser console
- Whether you're using HTTPS
- Location permission status
Contact Support
Include the debug information when reporting issues:
- GitHub Issues: Link to project repository
- Email: Include all debug information
- Forum: Post in relevant community
Workarounds
While waiting for fixes:
- Use manual entry for station details
- Search stations beforehand using map apps
- Keep a list of frequently visited stations
- Use desktop version if mobile has issues
Prevention Tips
Keep It Working
- Don't Block Location: Always allow when prompted
- Use HTTPS: Bookmark the secure URL
- Update Browser: Keep browser up to date
- Enable Location Services: Keep them on system-wide
- Test Regularly: Verify it works before you need it
Best Practices
- Allow Permission Once: It will remember for future visits
- Be Patient: GPS can take time for first fix
- Have Backup Plan: Know how to enter manually
- Check Signal: Use near windows or outdoors when possible
FAQ
Q: Why does it work sometimes but not others? A: GPS accuracy varies by location, weather, and device battery. Indoor locations often have poor GPS signal.
Q: Can I use it without GPS? A: Yes, use the "Enter Manually" option to input station details yourself.
Q: Is my location data stored? A: No, your coordinates are only used for the search and not saved or transmitted to our servers.
Q: Why does it need HTTPS? A: Modern browsers require secure connections for location access as a security measure.
Q: Can I search a different location? A: Currently, it only searches near your current location. Use manual entry for stations in other areas.
Success Indicators
You'll know it's working when:
- ✅ Modal opens immediately when clicking "Find Nearby"
- ✅ "Requesting your location..." message appears
- ✅ Location is obtained within 15 seconds
- ✅ Search results show nearby stations with distances
- ✅ Clicking a station fills the form fields automatically
If any step fails, refer to the troubleshooting steps above.