5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

cesiumでリアルタイム表示

Posted at

ずいぶん調べて、czmlで時間の経過とともにデータが増える
サンプルです。teimerで追加していますが、net.socketでデータを追加しても大丈夫だと思います。

そうそう、'../../Source/Assets/Textures/arcgis/tile'というローカルファイルでarcgisからダウンロードしたファイルで動くことにしていますが、地球がでませんねえ。'../../Source/Assets/Textures/NaturalEarthII'とかにすれば表示できるかもしれません。

<html lang="en">
<head>
    <!-- Use correct character set. -->
    <meta charset="utf-8">
    <!-- Tell IE to use the latest, best version (or Chrome Frame if pre-IE11). -->
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>Cesium Viewer</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="CesiumViewer.css" media="screen">
	<!--<script data-main="CesiumViewerStartup" src="../../ThirdParty/requirejs-2.1.9/require.js"></script>-->
    <script src="../../ThirdParty/requirejs-2.1.9/require.js"></script>
	<script type="text/javascript">
    require.config({
		baseUrl : '../../../Source',
        waitSeconds : 60
    });
    </script>
</head>
<body style="background: #000;">
    <div id="cesiumContainer" class="fullWindow"></div>
    <div id="loadingIndicator" class="loadingIndicator"></div>
	<script id="cesium_sandcastle_script">
function startupxxx(Cesium) {
    "use strict";
//Sandcastle_Begin
var local = new Cesium.TileMapServiceImageryProvider({
	url: '../../Source/Assets/Textures/arcgis/tile',
	fileExtension: 'jpeg'
	});
var viewer = new Cesium.Viewer('cesiumContainer',{
	//imageryProviderViewModels: [],
	imageryProvider: local,
	//selectedImageryProviderViewModel: local,
    baseLayerPicker : false
});

var layers = viewer.imageryLayers;
   

var 	count = 0;
var endtime=new Date();
var starttime = new Date();
	endtime.setMinutes(endtime.getMinutes()+3);
	var alltime=starttime.toISOString()+"/"+endtime.toISOString();
   function increment() {
	  var x = count * .2;
	  var now = new Date();
	  var nowtxt = now.toISOString();
	  var avtxt=nowtxt+"/"+endtime.toISOString();
	  var	msgData=[{"id":"document",
				"version":"1.0",
				"clock": {
				"interval": alltime ,
				"currentTime": nowtxt ,
				"multiplier": 12,
			 "step":"SYSTEM_CLOCK_MULTIPLIER"
					}
				},
				{  "id":"Plane",
					"availability": avtxt ,
	  				"billboard":{
						"image":'cross_y.png',
						"scale":1.0
					},
					"position":{
						  "interpolationAlgorithm":"LAGRANGE",
						  "interpolationDegree":1,
						  "cartographicDegrees":[139.6278 + x, 41.8819 + x, 1000]
					}
				}];

	  var czmlDataSource = new Cesium.CzmlDataSource();
	  czmlDataSource.process(msgData, 'model json');
	  viewer.dataSources.add(czmlDataSource);
	  
	  count++;
	  if(count<10)setTimeout(increment,3000);
	}

	setTimeout(increment,3000);


}
//Sandcastle_End
    //Sandcastle.finishedLoading();
if (typeof Cesium !== "undefined") {
    startup(Cesium);
} else if (typeof require === "function") {
    require(["Cesium"], startupxxx);
}
</script>
<
</body>
</html>
5
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?