A maptalks Layer to draw OD(Origin-Destination) lines.

npm install maptalks.odline.https://unpkg.com/maptalks.odline/dist/maptalks.odline.min.jsAs a plugin, maptalks.odline must be loaded after maptalks.js in browsers.
<link rel="stylesheet" href="https://unpkg.com/maptalks/dist/maptalks.css">
<script type="text/javascript" src="https://unpkg.com/maptalks/dist/maptalks.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/maptalks.odline/dist/maptalks.odline.min.js"></script>
<script>
var odlayer = new maptalks.ODLineLayer('od', data)
.addTo(map);
</script>
IE 9-11, Chrome, Firefox, other modern and mobile browsers.
ODLineLayer is a subclass of maptalks.ParticleLayer and inherits all the methods of its parent.
Constructor// data's format
// [{ coordinates : [[x, y], [x, y]], symbol : {..} }, { coordinates : [[x, y], [x, y]], symbol : {..} } ..]
// symbol only supports lineWidth and lineColor
new maptalks.ODLineLayer(id, data, options)
[{ coordinates : [[x, y], [x, y]], symbol : {..} }, { coordinates : [[x, y], [x, y]], symbol : {..} } ..]getData()get layer’s data
Returns Object[]
setData(data)set new data to the layer
Returns this
toJSON()export the ODLineLayer’s JSON.
var json = odlayer.toJSON();
Returns Object
We welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.
The only source file is index.js.
It is written in ES6, transpiled by babel and tested with mocha and expect.js.
$ npm install
$ npm run dev
$ npm test
$ npm run tdd
$ npm run build
$ npm run lint