Skip to content

DanielGuo1/cheapest_gasstation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Mapbox Tankerkönig

Cheapest gas station

Logo

Find the cheapest gas station in your area

About The Project

front_end

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).

Built With

Getting Started

If you want to run this code locally, get a copy and follow these simple steps.

Installation

  1. Get a free API Key at https://creativecommons.tankerkoenig.de
  2. Get a Access Token at https://docs.mapbox.com/help/getting-started/access-tokens
  3. Clone the repo
    git clone https://github.com/DanielGuo1/cheapest_gasstation.git
  4. Enter your API in main.js
    let apiKey = 'your_api_key'
  5. Enter your Access Token in main.js
    https://api.mapbox.com/{endpoint}?access_token={your_access_token}

Setup

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",
   },

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published