plunkerでcesium
概要
plunkerでcesiumやってみた。
covid-19の棒グラフやってみた。
写真
サンプルコード
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox: false
});
var entities = viewer.entities;
var boxes = entities.add(new Cesium.Entity());
d3.json("https://covid19-japan-web-api.now.sh/api/v1/prefectures", function(error, data) {
var keys = ["id", "name_ja", "name_en", "lat", "lng", "cases", "deaths"];
for (var i = 0; i < data.length; i++)
{
var n = 200.0 * data[i]["cases"];
entities.add({
parent: boxes,
position: Cesium.Cartesian3.fromDegrees(data[i]["lng"], data[i]["lat"]),
cylinder: {
length: n,
topRadius: 20000.0,
bottomRadius: 20000.0,
material: Cesium.Color.fromRandom({
alpha: 0.6
}),
}
});
}
viewer.zoomTo(viewer.entities);
});
成果物
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox: false
});
var entities = viewer.entities;
var boxes = entities.add(new Cesium.Entity());
d3.json("https://covid19-japan-web-api.now.sh/api/v1/prefectures", function(error, data) {
var keys = ["id", "name_ja", "name_en", "lat", "lng", "cases", "deaths"];
for (var i = 0; i < data.length; i++)
{
var n = 200.0 * data[i]["cases"];
entities.add({
parent: boxes,
position: Cesium.Cartesian3.fromDegrees(data[i]["lng"], data[i]["lat"]),
cylinder: {
length: n,
topRadius: 20000.0,
bottomRadius: 20000.0,
material: Cesium.Color.fromRandom({
alpha: 0.6
}),
}
});
}
viewer.zoomTo(viewer.entities);
});
以上。
Author And Source
この問題について(plunkerでcesium), 我々は、より多くの情報をここで見つけました https://qiita.com/ohisama@github/items/ffb5507f6e5d07e54a2e著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .