Skip to content

Latest commit

 

History

History
132 lines (87 loc) · 6.64 KB

README.md

File metadata and controls

132 lines (87 loc) · 6.64 KB

OSM analytics charts

This repository contains a set of charts based on the data from OSM analytics site and API.

It was developed primarily to integrate the above mentioned data on the OpenDRI website but it can be easily used in other contexts.

It also contains a basic application server that hosts a sandbox containing the charts above, for development and test purposes.

Requirements

Installation

Use npm to install all dependencies.

npm install

Development

To start a development server run:

npm run server

The sandbox page should now be available on http://localhost:8080

Configuration

The project comes preconfigured with sensible defaults, which should work in most cases.

If you want to override the default endpoints configuration, you need to duplicate the configuration file:

cp public/env.sample.js public/env.js

Then edit to override. You may need to restart the application server after you change the settings.

Production

To bundle all the dependencies and minify the code run:

npm run build

This creates public/bundle.js and public/styles.css which contain the minified, production-ready version of this library.

Charts configuration

Overall statistics table

Statistics table

Presents a set of configurable statistics about contributions done to OSM.

  • statistics (mandatory) ([{featureType: 'highways', stat: 'users'}]) an array of widgets objects, each being of the following form:
{
  featureType: 'highways'|'buildings'|'waterways'
  stat: 'activity'|'users'
}
  • country or polygon (mandatory) ISO3 country code or an encoded polyline of the area of interest related to the project (ie ifv%7BDndwkBx%60%40aYwQev%40sHkPuf%40ss%40%7BfA_%40uq%40xdCn%7D%40%5E))
  • start_date (mandatory) (2016-01-01) represents the start date of an OpenDRI project
  • end_date (mandatory) (2017-01-01) represents the end date of an OpenDRI project
  • precision (13) value between 1 and 13, specifying accuracy of data to display.

Single statistics value

Renders a plain value, with no formatting or unit.

  • country or polygon (mandatory) ISO3 country code or an encoded polyline of the area of interest related to the project (ie ifv%7BDndwkBx%60%40aYwQev%40sHkPuf%40ss%40%7BfA_%40uq%40xdCn%7D%40%5E))
  • start_date (mandatory) (2016-01-01) represents the start date of an OpenDRI project
  • end_date (mandatory) (2017-01-01) represents the end date of an OpenDRI project
  • feature_type (mandatory) (buildings) buildings, waterways or waterways
  • statistic (mandatory) (users) type should be either users or activity. users statistics are only available if precision is set to 13.
  • precision (13) value between 1 and 13, specifying accuracy of data to display.

Compare map

Compare map

The compare map consists of a trimmed-down, embedded version of the OSM Analytics site. It uses a slider to show the status of OSM contributions in two dates, allowing a seamless visual comparison between them.

  • width
  • height
  • settings.default_feature_type (buildings) compare buildings or highways or waterways
  • settings.iframe_base_url
  • settings.polygon an encoded polyline of the area of interest related to the project (ie ifv%7BDndwkBx%60%40aYwQev%40sHkPuf%40ss%40%7BfA_%40uq%40xdCn%7D%40%5E))
  • settings.default_start_year (2016) represents the default start year
  • settings.default_end_year (now) represents the default end year. now can also be provided to compare with latest OSM data

Activity chart

Activity chart

The activity charts illustrate a comparison between contributions done on multiple OSM features. As the features may not be directly aggregatable, a simplified [https://en.wikipedia.org/wiki/Mahalanobis_distance](Mahalanobis distance) calculation is used to aggregate contributions.

  • data (mandatory) raw data from the OSM Analytics API, it has to be loaded externally
  • apiUrl provide an API url for the 'Download data' button
  • range (mandatory) ([2010-03-06,2016-01-01) time range displayed, as a [from, to] array, regardless of the data provided
  • facet visible facet when loading the widget, must be 'users' or 'features' (default). users statistics are only available if precision is set to 13.
  • granularity visible granularity by default, must be 'monthly', 'weekly' or 'daily' (default)
  • precision (13) value between 1 and 13, specifying accuracy of data to display.

Aggregation method for contributions on different features

As information regarding activity in the OSM database is expressed in different units (i.e. number of km for roads or number of individual entries in the case of buildings) we had to normalize the values in order to aggregate them in a meaningful way. The approach we chose is a simplified Mahalanobis distance (multi-dimensional generalization of the idea of measuring how many standard deviations away a point is from the mean of a distribution) in which, by removing the original dimension from the original data, we are able to describe the features in regards to the whole set of points, allowing us to finally aggregate features of different units in the same histogram.

More info: source code

Top contributors

Contributors chart

The contributors chart shows a list of the top users for the given filter options, and an aggregated value for the remaining contributions

  • data (mandatory) raw data from the OSM Analytics API, it has to be loaded externally
  • apiUrl provide an API url for the 'Download data' button
  • numUsers number of users displayed, defaults to 10,
  • featureType (buildings) buildings, highways or waterways

See also: