Find the cheapest gas station in your area
In this project I created a Map that shows which gas station is the cheapest (and the most expensive) one, based on your location and the range you want to consider. I consumed the real-time gas station prices via this API Endpoint (API only available for Germany).
If you want to run this code locally, get a copy and follow these simple steps.
- Get a free API Key at https://creativecommons.tankerkoenig.de
- Get a Access Token at https://docs.mapbox.com/help/getting-started/access-tokens
- Clone the repo
git clone https://github.com/DanielGuo1/cheapest_gasstation.git
- Enter your API in
main.js
let apiKey = 'your_api_key'
- Enter your Access Token in
main.js
https://api.mapbox.com/{endpoint}?access_token={your_access_token}
Choose your location in main.js
let lat = 48.783333
let long = 9.183333
Adjust your range and fuel in main.js
$.ajax({
url: "https://creativecommons.tankerkoenig.de/json/list.php",
data: {
lat: lat,
lng: long,
rad: 10,
sort: "price",
type: "e5",
apikey: apiKey
},
Change the range in kilometers in main.js
data: {
rad: 10,
},
Change Fuel between: E10
, E5
or Diesel
in main.js
data: {
type: "e5",
},