Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laem/async-cartogram
Javascript non-blocking cartograms (web workers / node)
https://github.com/laem/async-cartogram
Last synced: 18 days ago
JSON representation
Javascript non-blocking cartograms (web workers / node)
- Host: GitHub
- URL: https://github.com/laem/async-cartogram
- Owner: laem
- License: mit
- Created: 2015-06-22T09:55:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-25T08:45:50.000Z (over 9 years ago)
- Last Synced: 2024-08-09T13:16:57.017Z (3 months ago)
- Language: JavaScript
- Homepage: https://laem.github.io/async-cartogram/
- Size: 2.26 MB
- Stars: 24
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
What ?
-----------A **js cartogram library** that does not block the browser, using **web workers**, forked from the original [d3 cartogram](http://prag.ma/code/d3-cartogram/). It can also be run with **node**, which is nice for preprocessing geometries offline.
- Designed to handle a series of cartograms (called tasks) : compute all the maps at once then display them smoothly.
- Using only a geo subset of d3 (you'll probably use d3 again to display the map in the browser, add colors, transitions, hovers...).
- Also attempts to add the effective range tip from Algorithms for Cartogram Animation,
by Ouyang et al., hopefully making it slightly faster.Usage :
--------The library is compiled in `dist/` as [UMD](https://github.com/umdjs/umd), and has been tested using `require("dist/async-cartogram.js")`
```js
var promiseOfGeometries = AsyncCartogram(
{
topology: topojsonData,
// geometries to reshape:
geometries: topojsonData.objects.OBJECTNAME.geometries,
projection: {
name: 'mercator',
translation: [X,Y],
scaling: scalingFactor, //e.g. 2000
center: [long, lat]
}
},
values, // { taskId => { geoJsonFeatureValue => newArea} }
featureProperty // geoJsonFeatureIdKey to link geojson features to values
);
```See the [example](https://github.com/laem/async-cartogram/tree/master/example) app (cartogram of Paris) for detailed usage.
![L'escargot](https://raw.githubusercontent.com/laem/async-cartogram/master/example/capture.png)
Check the project for which this lib was created, [a 90-years cartogram of europe](https://github.com/laem/eurpop).