GithubHelp home page GithubHelp logo

eurostat / eurostat-map.js Goto Github PK

View Code? Open in Web Editor NEW
60.0 6.0 4.0 134.21 MB

Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.

Home Page: https://github.com/eurostat/eurostat-map.js

License: Other

JavaScript 96.40% HTML 3.59% CSS 0.01%
eurostat map nuts web-mapping svg topojson choropleth choropleth-map proportional-symbol-maps

eurostat-map.js's Introduction

eurostat-map.js

npm bundle size npm Build Status license

Quickly create and customise thematic web maps based on NUTS regions, showing Eurostat data directly retrieved from the Eurostat database.

Examples

Installation

  • Node.js: With npm install eurostatmap and then eurostatmap = require("eurostatmap").
  • Standalone: For the latest version, use <script src="https://unpkg.com/eurostat-map"></script> as shown in the examples. For a fixed version, use <script src="https://unpkg.com/[email protected]"></script>, where X.Y.Z is a version number among these ones.

Documentation

See the API reference:

Anything unclear or missing? Feel free to ask !

Technical details

Maps based on NUTS regions rely on Nuts2json API and TopoJSON format. Statistical data are accessed using Eurostat REST webservice for JSON-stat data. The data are decoded and queried using JSON-stat library. Maps are rendered as SVG maps using D3.js library.

About

contributors
version See npm
status Since 2018
license EUPL 1.2

Support and contribution

Feel free to ask support, fork the project or simply star it (it's always a pleasure).

Copyright

The Eurostat NUTS dataset is copyrighted. There are specific provisions for the usage of this dataset which must be respected. The usage of these data is subject to their acceptance. See the Eurostat-GISCO website for more information.

Disclaimer

The designations employed and the presentation of material on these maps do not imply the expression of any opinion whatsoever on the part of the European Union concerning the legal status of any country, territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries. Kosovo*: This designation is without prejudice to positions on status, and is in line with UNSCR 1244/1999 and the ICJ Opinion on the Kosovo declaration of independence. Palestine*: This designation shall not be construed as recognition of a State of Palestine and is without prejudice to the individual positions of the Member States on this issue.

eurostat-map.js's People

Contributors

dependabot[bot] avatar jgaffuri avatar joewdavies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

eurostat-map.js's Issues

Several statistics maps

In order to be able to make maps based on several statistics, it is necessary to make it possible to load not only one but several statistical sources.

Examples of such maps:

Make application with interactivity

Use GUI components to allow users to change map parameters (Converging toward a new IMAGE ?).
Or make SVG elements (map title, etc.) editable (example: click on a text element to edit it)

  • Time slider
  • Selection of databases.

Continuous color ramps for choropleth maps

Currently, only discrete classifications are available for choropleth maps.
Continuous color ramps, with different scaling functions (linear, logarithmic, exponential, etc.) should be proposed.

Export map. As a SVG file.

For users willing to further customise their map, a possibility to export the map as a SVG file to be edited with (for example) inkscape, should be provided.
In oder to make these SVG files thiner, it might be needed to round the coordinates first, with d3.round function.

Programmatic definition of statistical data

Make it possible to define cartographic figures directly in javascript code like that:

map.setStat(
{
  LU01: 3534.345,
  DE02: 45.453,
  LV45: 6454.3534,
...
});

Rely on out._statDataIndex; attribute.

Zoom effect on stroke-width

When using the zoom, the "stroke-width" styles should be changed according to the real value specified by the user. Currently, the zoom sets the width to 1px, whatever the zoom level.

Do not show countries

  • include a new geometry in nuts2json for the land mass.
  • show this new geometry as a background, above the sea rectangle and below the nuts/cntr geometries.
  • add option to show/hide country geometries
  • add option for the fill style of this land mass geometry.

Note that this land mass geometry is required for the value-by-alpha map. Otherwise, when changing the regions opacity, the blue of the sea will appear...

The land mass polygon could be used to make coastal margin: https://observablehq.com/@jgaffuri/coastal-margin-with-css-stroke-width

.psStrokeWidth not working

Proportional circle map stroke width setter only changes stroke width of legend circles:

.psStrokeWidth(0.1)

List of inspiration sources for new map types

Add possibility to show shadowed effect for the countries AND buffered lines as on this image:
https://previews.123rf.com/images/schwabenblitz/schwabenblitz1606/schwabenblitz160601040/58074061-map-of-denmark-with-the-provinces-south-denmark-is-highlighted-by-a-hatching-.jpg

Show temporal data using:
https://github.com/tomshanley/d3-spiral-heatmap

As an alternative to pie charts, use other types of shapes do show decomposition (radial pie charts, squares (flag like), etc.). See some examples here, in some images at the bottom:
https://observablehq.com/@tomshanley/cheysson-color-palettes

Make compositions possible?

  • compositions chroploth + prop circle
  • composition choropleth map showing variation (diverging colors) + rectangle/bar showing quantities +/-

Add map insets

Based on what has been recently added to Nuts2json API.

Show map data source

Currently, the source of the map information is not shown on the examples.
For maps based on eurostat data, we should have something like: "Source, Eurostat XXX" where XXX is the eurostat database code, with a link to the corresponding page on Eurostat website.
Example: https://ec.europa.eu/eurostat/databrowser/view/road_eqs_busmot_h/ for database with code road_eqs_busmot_h.

This could information be shown as part of the legend box, the bottom text (currently used for the copyright) or another map component ? Maybe another map component at the bottom right corner, or under the insets, is the most suitable.

proportional symbols - make other symbols possible, not only circles

  1. The "transform" attribute should be used to scale and move the group symbol instead of current circle radius.
  2. Propose list of predefined symbols (circle, square, etc. see https://github.com/d3/d3-shape#symbols) and maybe user defined ones (as SVG paths)
  3. Beside proportionnal symbols, vertical bars could also be proposed. In that case, the scaling of the symbol would occur only along the vertical dimension. Example: https://4.bp.blogspot.com/-IbwkPe0Cd7o/Tv74ukFKxbI/AAAAAAAAALw/hDwLkziybiw/s1600/barMap.png

Add geographical names

The map template could be enhanced by adding few geographical names such as ocean names or country names for large maps.

See for example how it could look like on country names: https://www.nytimes.com/interactive/2020/10/22/world/europe/europe-hospitals-covid.html
https://www.mapsofworld.com/europe/maps/political-map-of-europe.jpg

Some useful resources:
https://css-tricks.com/snippets/svg/curved-text-along-path/
https://vanseodesign.com/web-design/svg-text-on-a-path-part-1/
Suitable cartographic fonts could be used: https://www.typography.com/fonts/styles/cartography

Free color ramps

Currently, color ramps for choropleth maps are based on color-brewer/d3-chromatic lib.
The possibility should be given to use any kind of user defined color ramp, such as the Eurostat color ramps (already defined in eurostat-map.js).

Define map styles with CSS

Currently, map styles are defined in javascript with .style(...) functions.
It could be interesting to see if some styling parameters could be defined with CSS instead.
Check if CSS overrides the SVG styling.

Add new map types: Bivariate choropleth

Document and comment

  • Comment the code
  • Keep documentation (README.md) progressively synchronised with latest developments, as much as possible
  • Keep examples progressively synchronised with latest developments, as much as possible

Add new map type: Composition stripes map

This map shows the composition of something using striped texture. Each stripe represent a category. Different colors are used to differenciate the different categories. The width of each stripe is proportionnal to the share of the category in the total. The total width of the stripes for all categories is the same for all regions (equal to 100%). For each region, the stripe sequence is repeated periodically accross the region geometry.

Example:
See image, top row, second from the right: https://philogb.github.io/blog/assets/france/bertin.png

Use that to show:

  • Population by age group
  • Livestock composition by animal
  • GDP by NACE type
  • Mortality by cause of death
  • Household consumption by COICOP
  • Governement expenditure by COFOG
  • etc.

New example map for prop symbols

Currently on the website, we have only one example map showing prop symb as circles. It would be nice to add a new one with another type of symbol. With another variable than population (as soon as it is a quantity!).
This task should include the addition of a 250*250 thumbnail of the new map on the pages.

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.