How It Works
A transparent look at how we collect prices, power the map, and handle your data.
Step 1 — Collecting Gas Price Data
Our backend server runs a scheduled collection job every hour. It reads community-reported Canadian fuel-price feeds, validates the station, fuel grade, price and report timestamp, then matches the observation to our station catalogue.
The primary feed supplies reports across Vancouver and the wider Metro Vancouver markets we cover. We keep the source’s report time separate from our own database-update time. This matters: a successful hourly collection run does not necessarily mean somebody reported a new pump price at every station during that hour.
Each hourly batch updates our PostgreSQL database with the latest price for every station. If the API returns no data for a given run (due to a rate limit, network issue, or the API being temporarily down), we simply serve the most recently cached prices from our database and display the "last updated" timestamp on each station card so you know how fresh the data is.
Step 2 — Our Database
Station records are stored with their address, geographic coordinates (latitude and longitude), brand, and any reported price in cents per litre. When the feed returns an existing station with a new price, we update only the price and timestamp — we don't create duplicate records.
The catalogue also contains map records for stations that do not have a recent price. Those records remain useful for location and navigation, but they appear without a current price and do not enter the “cheapest today” ranking. We do not invent or interpolate a live pump price when a report is missing.
Step 3 — Serving the Data
Our API server (Node.js + Express) exposes a few simple JSON endpoints:
- /api/stations/cheapest — returns the top 20 cheapest active stations in Vancouver
- /api/stations?lat=&lng=&radiusKm= — returns stations within a given radius of a coordinate, sorted by price then distance
- /api/stations/:id — returns a single station's full detail
Distance filtering uses the Haversine formula, which gives accurate straight-line distances between two GPS coordinates without needing a full mapping engine on the server side.
Step 4 — The Map
The interactive map is powered by Leaflet, an open-source JavaScript mapping library, using OpenStreetMap tiles. OpenStreetMap is a community-maintained, royalty-free map dataset. No Google Maps API key or payment is required to display the map.
When stations are loaded, we place a marker pin at each station's GPS coordinates. Clicking a pin shows a small popup with the station name, current price, address, and a link to open directions in Google Maps.
If you share your location, a separate red dot marks where you are on the map, and the view automatically zooms to show the stations nearest to you.
Step 5 — Your Location
The "Nearest to Me" feature uses the browser's built-in navigator.geolocation API. This is a standard web API that asks your device's operating system for your GPS or Wi-Fi-based position. The browser shows you a permission prompt before sharing any location data.
Once you allow access, your latitude and longitude are sent to our API server only to query nearby stations. Our application does not save these coordinates in its database or send them as analytics events. The request looks like:
GET /api/stations?lat=49.28&lng=-123.12&radiusKm=10
These coordinates travel over HTTPS (encrypted) and are used only to filter the station list in memory on our server. The nearby-search API route is excluded from our origin access log.
If you decline location access, you can still search by entering a Vancouver postal code. We use a rough lookup table to convert the postal code prefix into approximate coordinates — accurate enough to find nearby stations, but not precise enough to identify your exact address.
Price Accuracy
We display prices as reported by our data source. In practice this means prices are usually within 1–3 cents of what you'll see at the pump, but they are not guaranteed to be exact. Prices can change multiple times a day, particularly when wholesale oil prices move sharply.
Always glance at the physical pump price before you start filling up. The time on each station card is the source report time when one is available; a stale label warns when that observation has aged beyond the current-price window.
For more on accuracy and our data disclaimer, see the Disclaimer page.