The **WebGL Globe** is an open platform for visualizing geographic
information in WebGL enabled browsers.
It supports data in JSON format, a sample of which you can find [here]
(https://github.com/dataarts/dat.globe/raw/master/globe/population909500.json). dat.globe makes heavy use of the [Three.js](https://github.com/mrdoob/three.js/)
library, and is still in early open development.
### Data Format ###
The following illustrates the JSON data format that the globe expects:
```javascript
var data = [
[
'seriesA', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
],
[
'seriesB', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
]
];
```
### Basic Usage ###
The following code polls a JSON file (formatted like the one above)
for geo-data and adds it to an animated, interactive WebGL globe.
```javascript
// Where to put the globe?
var container = document.getElementById( 'container' );
// Make the globe
var globe = new DAT.Globe( container );
// We're going to ask a file for the JSON data.
xhr = new XMLHttpRequest();
// Where do we get the data?
xhr.open( 'GET', 'myjson.json', true );
// What do we do when we have it?
xhr.onreadystatechange = function() {
// If we've received the data
if ( xhr.readyState === 4 && xhr.status === 200 ) {
// Parse the JSON
var data = JSON.parse( xhr.responseText );
// Tell the globe about your JSON data
for ( i = 0; i < data.length; i++ ) {
globe.addData( data[i][1], 'magnitude', data[i][0] );
}
// Create the geometry
globe.createPoints();
// Begin animation
globe.animate();
}
}
};
// Begin request
xhr.send( null );
```
没有合适的资源?快使用搜索试试~ 我知道了~
webgl globe
共20个文件
js:6个
html:3个
ds_store:3个
4星 · 超过85%的资源 需积分: 10 22 下载量 28 浏览量
2013-07-07
13:19:45
上传
评论 1
收藏 401KB ZIP 举报
温馨提示
来自Google的WebGL Globe源代码哦,超炫值得一看想在网页上看地球吗
资源推荐
资源详情
资源评论
收起资源包目录
webgl-globe.zip (20个子文件)
globe
population909500.json 366KB
world.jpg 93KB
ce.png 5KB
index.html 5KB
.DS_Store 6KB
third-party
.DS_Store 6KB
Three
ThreeWebGL.js 139KB
RequestAnimationFrame.js 558B
Detector.js 2KB
ThreeExtras.js 93KB
LICENSE 1KB
Tween.js 4KB
globe.js 12KB
loading.gif 3KB
LICENSE 563B
globe-search
embed.html 3KB
search.json 508KB
index.html 3KB
.DS_Store 6KB
README.md 2KB
共 20 条
- 1
一码超神
- 粉丝: 330
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页