maptalks.odline

CircleCI NPM Version

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

screenshot

Examples

Install

Usage

As 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>

Supported Browsers

IE 9-11, Chrome, Firefox, other modern and mobile browsers.

API Reference

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)

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

Contributing

We welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.

Develop

The only source file is index.js.

It is written in ES6, transpiled by babel and tested with mocha and expect.js.

Scripts