Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

README.md

See my post about the subject : http://kevin.saliou.name/posts/2013-10-22-geojson-carburantes.html

Spain's petrol stations' data

This is a simple script I created to download the latest oficial price list for all types of petrol of all the petrol stations in Spain provided by the Gobierno de España. Ministerio de Industria, Energía y Turismo. : http://www.geoportalgasolineras.es/

  • The tool this portal provides is very user UN friendly,
  • The tool this portal provides is completely UN accessible (try to open it up in your mobile phone),
  • The data source is somewhat hard to find, and if you do manage to find it, its format is not well structured, making hard to exploit.

This script will :

Ultimately I would like to have a user-friendly (and accessible) solution for users to easily check with any type of browsers (desktop or mobile) where the nearest and cheapest petrol stations are. There are a number of mobile apps available out there (https://play.google.com/store/search?q=gasolineras&c=apps), but all of them are :

  • mobile only
  • closed source!

Install

pip install -r requirements.txt

wget https://raw.github.com/kbsali/gasolineras-espana/master/open_gasolineras.py
chmod +x open_gasolineras.py

$ ./open_gasolineras.py -h
Usage: ./open_gasolineras.py [-d DIR] [-r DIR] [--quiet | --verbose]

-h --help       show this
-d DIR          specify where json output files are saved [default: .]
-r DIR          specify raw output directory [default: .]
-quiet          do not show any debug traces

./open_gasolineras.py -d /PATH/TO/... --quiet

Output

The script will save the json + geojson files in sub directories for each date and an extra latest directory so you always have the option to access the latest file easily :

├── geojson
│   ├── 20131004
│   │   ├── BIO.geojson
│   │   ├── G98.geojson
│   │   ├── GOA.geojson
│   │   ├── GPR.geojson
│   │   └── NGO.geojson
│   └── latest
│       ├── BIO.geojson
│       ├── G98.geojson
│       ├── GOA.geojson
│       ├── GPR.geojson
│       └── NGO.geojson
└── json
    ├── 20131004
    │   ├── BIO.json
    │   ├── G98.json
    │   ├── GOA.json
    │   ├── GPR.json
    │   └── NGO.json
    └── latest
        ├── BIO.json
        ├── G98.json
        ├── GOA.json
        ├── GPR.json
        └── NGO.json

See it live!

I have a cron job executing the script daily on my server, use the json files at your own will : http://gas.saliou.name. Here are sample files :

Naming convention

I kept the same naming policy as on the original source :

  • GPR : Gasolina 95 (G.Protección)
  • G98 : Gasolina 98
  • GOA : Gasóleo A habitual
  • NGO : Nuevo gasóleo A
  • GOB : Gasóleo B
  • GOC : Gasóleo C
  • BIO : Biodiésel
  • G95 : Gasolina 95
  • BIE : Bioetanol
  • GLP : Gases licuados del petróleo
  • GNC : Gas natural comprimido

About

Retrieve, parse and transform full list of Spanish petrol stations' prices

Resources

Releases

No releases published

Languages

You can’t perform that action at this time.