Giter Site home page Giter Site logo

gasolineras-espana's Introduction

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

gasolineras-espana's People

Contributors

kbsali avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.