This Wordpress plugin provides integration with OSMA to display charts and maps inside pages.
Install like any other Wordpress plugin
The plugin supports 2 configuration values, both of which are required:
- API URL: Address the API endpoint, typically ending in
/api/v1
- Site URL: Address of the OSM analytics site, used in map embeds.
The plugin currently provides 3 shortcodes, each rendering a different visualization:
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.
osma_charts_compare_map
- 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
)) - default_start_year (
2016
) represents the start year of an OpenDRI project - default_end_year (
now
) represents the end year of an OpenDRI project.now
can also be provided to compare with latest OSM data - default_feature_type (
buildings
) comparebuildings
orhighways
[osma_charts_compare_map country="HTI" default_feature_type="highways" default_start_year="2015" default_end_year="now"]
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.
osma_charts_activity
- 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 - default_granularity (
daily
) show activitydaily|weekly|monthly
by default - default_facet (
features
) show eitherfeatures
orusers
histogram by default.users
facet is only supported if precision is set to 13. - precision (
13
) value between 1 and 13, specifying accuracy of data to display.
[osma_charts_activity country="HTI" start_date="2000-01-01" end_date="2017-02-01" default_granularity="monthly" default_facet="features"]
The contributors chart shows a list of the top users for the given filter options, and an aggregated value for the remaining contributions
osma_charts_contributors
- 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 - num_users (
10
) number of users to show on the chart. - feature_type (
buildings
) buildings, highways or waterways
[osma_charts_statistics_table country="UGA" start_date="2010/01/01" end_date="2017/02/01" statistics="buildings-users,buildings-activity,waterways-users,waterways-activity"]
The statistics table shows a list of the most relevant statistics for a given geography and time range.
osma_charts_statistics_table
- 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 - statistics (mandatory) (
buildings-users,...
) a comma separated list of feature/type pairs. Each feature/type pair must be separated by a dash. Features can bebuildings
,waterways
orwaterways
, and type should be eitherusers
oractivity
.users
statistics are only available if precision is set to 13. - precision (
13
) value between 1 and 13, specifying accuracy of data to display.
[osma_charts_statistics_table country="UGA" start_date="2010/01/01" end_date="2017/02/01" statistics="buildings-users,buildings-activity,waterways-users,waterways-activity"]
Shows a single statistical value for a given geography and time range. Ideal for embedding inline with other text.
osma_charts_statistic_value
- 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
orwaterways
- statistic (mandatory) (
users
) type should be eitherusers
oractivity
.users
statistics are only available if precision is set to 13. - precision (
13
) value between 1 and 13, specifying accuracy of data to display.
[osma_charts_statistic_value country="UGA" start_date="2010/01/01" end_date="2017/02/01" feature_type="buildings" statistic="activity"]
This plugin is a Wordpress wrapper for JavaScript/CSS found in OSMA Charts, and the content of scripts
and styles
are exports of that project.
On the source repo, build and push:
npm run build
...
git push origin master
On this repo, update and copy the dependencies:
npm update && npm run update-osma-charts