2012-05-08 78 views
1

Google地球默认为“边框和标签”(即显示国家/地区轮廓)。我有我想要关闭边框的KMZ/KML文件。我搜索了描述KML的文档,但无法找到与图层相关的任何内容。通过KML关闭国家边界

我也尝试保存有和没有打开边界的KMZ文件,它们是相同的。

任何人都知道如何通过KML API访问图层?

回答

0

您现在还无法通过KML直接打开/关闭Google地球中的图层。目前这是由Google地球用户完成的手动操作。

但是,目前有一个指令来打开/关闭历史图像,街景和太阳光照模式。 https://developers.google.com/kml/documentation/kmlreference#gxvieweroptions

但是你可以通过GE API打开/关闭容易各层:

要启用的特定层:

ge.getLayerRoot().enableLayerById(ge.LAYER_NAME, true) 

要禁用层:

ge.getLayerRoot().enableLayerById(ge.LAYER_NAME, false); 

参考:https://developers.google.com/earth/documentation/layers#layers

0

API没有为ge.LAYER_BORDERS中的单个图层定义常量,但如果您查看KML文件,则每个“文件夹”节点都有一个ID,因此,正如JasonM1所说,您可以对每个想要的图像使用enableLayerById关闭包含节点的顶部(本例中为ge.LAYER_BORDERS)。

下面是我用经由API清理“边框和标签”层的代码:

ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true); 
ge.getLayerRoot().enableLayerById("530286de-c7b3-11dc-938c-dd553d8c9902", false);  // internation borders 
ge.getLayerRoot().enableLayerById("cfdff130-394a-11e0-98fa-dd5743f1dfd8", false);  // coastline 
ge.getLayerRoot().enableLayerById("533444c6-c7b3-11dc-b02e-dd553d8c9902", false);  // 1st level borders too 
ge.getLayerRoot().enableLayerById("534ab67a-c7b3-11dc-a2a7-dd553d8c9902", false);  // 2nd level borders too 
ge.getLayerRoot().enableLayerById("e2334aaa-e853-11df-9192-77880e18aa7d", false);  // geographic features 

P.S.我似乎无法找到我现在在哪里得到“边界和labels.kml”文件,但它可能在某处,将继续寻找...