使用任何Earth API进行实时数据可视化

时间:2020-12-01 03:53:54

How to create something like on this video (1-2 minutes http://www.ted.com/index.php/talks/sergey_brin_and_larry_page_on_google.html) using "Google Earth API" or some other?

如何使用“Google Earth API”或其他方式在此视频上创建类似内容(1-2分钟http://www.ted.com/index.php/talks/sergey_brin_and_larry_page_on_google.html)?

Especially: I have an online game and want to show dynamical data on some "virtual earth". 3 types of objects changing their state in real-time. It's enough to update each 5 seconds. I already have open api for it.

特别是:我有一个在线游戏,并希望在一些“虚拟地球”上显示动态数据。 3种类型的对象实时改变其状态。足以每5秒更新一次。我已经开放api了。

The problem is i do not know if it's possible to draw something like colored lines from a sphere's center and change them dynamically.

问题是我不知道是否可以从球体的中心绘制类似彩色线条的东西并动态地改变它们。

Sorry for an abstract question, but the goal is the same.

很抱歉有一个抽象的问题,但目标是一样的。

1 个解决方案

#1


Well, if you're using the Google Earth API (requires that the Google Earth Plugin be installed), you can just create a bunch of extruded polygons. For example, if you go to the Earth API Interactive Sampler and paste/run this:

好吧,如果您使用的是Google Earth API(需要安装Google地球插件),您只需创建一堆拉伸多边形即可。例如,如果您转到Earth API交互式采样器并粘贴/运行此:

var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
var lat = lookAt.getLatitude();
var lng = lookAt.getLongitude();

// first create inner and outer boundaries
// outer boundary is a square
var outerBoundary = ge.createLinearRing('');
var coords = outerBoundary.getCoordinates();
coords.pushLatLngAlt(lat - 0.5, lng - 0.5, 1000000); 
coords.pushLatLngAlt(lat - 0.5, lng + 0.5, 1000000); 
coords.pushLatLngAlt(lat + 0.5, lng + 0.5, 1000000); 
coords.pushLatLngAlt(lat + 0.5, lng - 0.5, 1000000); 

// create the polygon and set its boundaries
var polygon = ge.createPolygon('');
polygon.setExtrude(true);
polygon.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);
polygon.setOuterBoundary(outerBoundary);

// create the polygon placemark and add it to Earth
var polygonPlacemark = ge.createPlacemark('');
polygonPlacemark.setGeometry(polygon);
ge.getFeatures().appendChild(polygonPlacemark);

// persist the placemark for other interactive samples
window.placemark = polygonPlacemark;
window.polygonPlacemark = polygonPlacemark;

You'll see a 3D polygon extruded out of the globe.

你会看到一个3D全球被挤出地球。

There's much more you can do with this; I suggest playing with the Earth API and KML (foundation for geometry primitives in the Earth API) by visiting code.google.com/apis/earth and code.google.com/apis/kml.

你可以做更多的事情;我建议您访问code.google.com/apis/earth和code.google.com/apis/kml,使用Earth API和KML(Earth API中的几何图元基础)。

#1


Well, if you're using the Google Earth API (requires that the Google Earth Plugin be installed), you can just create a bunch of extruded polygons. For example, if you go to the Earth API Interactive Sampler and paste/run this:

好吧,如果您使用的是Google Earth API(需要安装Google地球插件),您只需创建一堆拉伸多边形即可。例如,如果您转到Earth API交互式采样器并粘贴/运行此:

var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
var lat = lookAt.getLatitude();
var lng = lookAt.getLongitude();

// first create inner and outer boundaries
// outer boundary is a square
var outerBoundary = ge.createLinearRing('');
var coords = outerBoundary.getCoordinates();
coords.pushLatLngAlt(lat - 0.5, lng - 0.5, 1000000); 
coords.pushLatLngAlt(lat - 0.5, lng + 0.5, 1000000); 
coords.pushLatLngAlt(lat + 0.5, lng + 0.5, 1000000); 
coords.pushLatLngAlt(lat + 0.5, lng - 0.5, 1000000); 

// create the polygon and set its boundaries
var polygon = ge.createPolygon('');
polygon.setExtrude(true);
polygon.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);
polygon.setOuterBoundary(outerBoundary);

// create the polygon placemark and add it to Earth
var polygonPlacemark = ge.createPlacemark('');
polygonPlacemark.setGeometry(polygon);
ge.getFeatures().appendChild(polygonPlacemark);

// persist the placemark for other interactive samples
window.placemark = polygonPlacemark;
window.polygonPlacemark = polygonPlacemark;

You'll see a 3D polygon extruded out of the globe.

你会看到一个3D全球被挤出地球。

There's much more you can do with this; I suggest playing with the Earth API and KML (foundation for geometry primitives in the Earth API) by visiting code.google.com/apis/earth and code.google.com/apis/kml.

你可以做更多的事情;我建议您访问code.google.com/apis/earth和code.google.com/apis/kml,使用Earth API和KML(Earth API中的几何图元基础)。