1.0.1 • Published 8 years ago

cagliari-opendata v1.0.1

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

Cagliari Open Data SDK for node.js

NPM

About

Basic Node.js libraries to use Cagliari Open Data API endpoints.

WARNING: current version has been updated to use ECMAscript 6 Promise and it's not backward compatible with previous versions. If you prefer continuing to use callbacks, please use version 0.2.5

Requirements

Node.js > v6.3.x

Supported Datasets and API Endpoints

  • Traffic

Installation

npm install cagliari-opendata

Basic Example

Getting all installed traffic monitoring stations:

const opendata = require('cagliari-opendata');
const traffic = opendata.traffic;

traffic.getStations()
.then(stations => { 
       console.log(stations);        
});

API

All functions are asynchronous and they return a Promise.

  • traffic.getStations()
  • traffic.getStation()
  • traffic.getStationData()
  • traffic.getSensorData()

Data Description

JSON representations returned by API calls contain the following data items. JSON is the only supported format. See descriptions for details.

JSON fieldDescrizione (Italian)Description (English)
tipoApparato2 == Postazione con un sensore per ogni senso di marcia; 4 == Postazione con due spire2 == Station with a sensor per direction; 4 == Station with two loops
classe: "Totali"Totale di tutte le classiOverall value of all classes
classe: "X - Y m"Lunghezza del veicolo da X metri a Y metriVehicle length from X to Y meters
classe: "Oltre m"Lunghezza del veivolo superiore a 22 metriVehicle length exceeding 22 meters
tipoClassificazione0 == Flusso e velocità; 1 == Solo Flusso0 == Flow and Speed; 1 == Flow, only
efficienza100 == Dati flusso e velocità; 0 == Dati di solo flusso100 == Flow and Speed data; 0 == Flow, only
velocitaVelocità in Km/hSpeed in Km/h
flussoVeicoli per oraVehicles per hour
tassoPercentuale (%)Percentage (%)

getStations()

Gets all available traffic stations installed in the city.

A JSON is returned.


getStation(id)

Gets info about a particular station given its id.

A JSON is returned.

  • id is the numeric or String id of the station

getStationData(id, startDate, endDate)

Gets measurement data from all the sensors in a station, given its id.

A JSON is returned.

  • id is the numeric or string id of the station
  • startDate a Date object representing the start date/time for required measurements (mandatory)
  • endDate a Date object representing the end date/time for required measurements (optional, use null to skip)

getSensorData(id, startDate, endDate)

Gets measurement data from for a specific sensor, given its id.

A JSON is returned.

  • id is the numeric or string id of the sensor
  • startDate a Date object representing the start date/time for required measurements (mandatory)
  • endDate a Date object representing the end date/time for required measurements (optional, use null to skip)

Links

Contributors

License - "MIT License"

Copyright (c) 2016 Antonio Pintus (http://www.pintux.it), Cristian Lai

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.0.1

8 years ago

1.0.0

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago