A maptalks Layer to render gltf
MIT License
maptalks.wind
is a maptalks layer used to rendering the globle wind data which get from the US National Weather Service publishes weather data for the whole globe, known as GFS. This project is heavily inspired by the work of https://github.com/mapbox/webgl-wind.
npm install maptalks.wind
.https://unpkg.com/maptalks.wind/dist/maptalks.wind.js
<script type="text/javascript" src="../maptalks.wind.js"></script>
<script>
var map = new maptalks.Map({});
var windData = {
date: "2016-11-20T00:00Z",
height: 180,
image: '2016112000.png',
source: "http://nomads.ncep.noaa.gov",
uMax: 26.8,
uMin: -21.32,
vMax: 21.42,
vMin: -21.57,
width: 360
};
var windlayer = new maptalks.WindLayer('wind', {
data : windData
}).addTo(map);
</script>
import { WindLayer } from 'maptalks.wind';
const windData = {
date: "2016-11-20T00:00Z",
height: 180,
image: '2016112000.png',
source: "http://nomads.ncep.noaa.gov",
uMax: 26.8,
uMin: -21.32,
vMax: 21.42,
vMin: -21.57,
width: 360
};
const windlayer = new WindLayer('wind', {
data : windData
});
import { WindLayer } from 'maptalks.wind';
const windlayer = new WindLayer('wind', {
data : '../path/gfs.json'
});
OR
const windData = {...};
const windlayer = new WindLayer('wind', {
data : windData
});
IE 9-11, Chrome, Firefox, other modern and mobile browsers.
Constructor
WindLayer
is a subclass of maptalks.Layer and inherits all the methods of its parent.
new maptalks.WindLayer(id, options)
setWind(data)
set the wind data for windlayer
windlayer.setWind(data);
{
height: 180,
image: '2016112000.png',
uMax: 26.8,
uMin: -21.32,
vMax: 21.42,
vMin: -21.57,
width: 360
}
setParticlesCount(count)
set the count for particles
windlayer.setParticlesCount(count);
getParticlesCount()
get the count of particles for windlayer
windlayer.getParticlesCount();
Returns Number
setRampColors(colors)
set the ramp color for rendering particles
windlayer.setRampColors(colors);
{
0.0: '#3288bd',
0.1: '#66c2a5',
0.2: '#abdda4',
0.3: '#e6f598',
0.4: '#fee08b',
0.5: '#fdae61',
0.6: '#f46d43',
1.0: '#d53e4f'
}
getWindSpeed(coordinate)
get the wind speed on specified location
windlayer.getWindSpeed(coordinate);
Returns Array
It is written in ES6, transpiled by babel and tested with mocha and expect.js.
$ npm install
$ npm run dev
$ npm run build
$ npm run test