我需要能够将具有给定高度的多边形对象放置在位于地面上方的KML中。我希望将空域信息显示为KML,并且每个空域都具有低海拔和高海拔值。
到目前为止,我能够做的最接近的事情是创建两个不同海拔高度的多边形来显示空域,但我无法连接多边形来显示中间区域。
感谢您的帮助
答案 0 :(得分:6)
您有两个选项,可以创建空域的collada模型,或者定义每个面的一系列多边形对象,
可以定义垂直方向的多边形,注意你的方向(顺时针或逆时针),因为这将影响样式,从底部查看多边形使其稍暗(
对于简单的矩形形状,您将需要6个面
以下kml是五边形示例的修改版本,其中一个垂直面填充,其他4个垂直面需要完整,但您将得到这个想法。
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>pm1.kml</name>
<Style id="poly">
<LineStyle>
<color>f0ffed42</color>
</LineStyle>
<PolyStyle>
<color>e8ff9257</color>
</PolyStyle>
</Style>
<Placemark>
<styleUrl>#poly</styleUrl>
<Polygon>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-77.05844056290393,38.86996206506943,500 -77.05552622493516,38.868757801256,500
-77.05315536854791,38.87053267794386,500 -77.05465973756702,38.87291016281703,500 -77.05788457660967,38.87253259892824,500 -77.05844056290393,38.86996206506943,500 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<styleUrl>#poly</styleUrl>
<Polygon>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-77.05844056290393,38.86996206506943,400 -77.05552622493516,38.868757801256,400
-77.05315536854791,38.87053267794386,400 -77.05465973756702,38.87291016281703,400 -77.05788457660967,38.87253259892824,400 -77.05844056290393,38.86996206506943,400 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<styleUrl>#poly</styleUrl>
<Polygon>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-77.05844056290393,38.86996206506943,500 -77.05844056290393,38.86996206506943,400 -77.05552622493516,38.868757801256,400 -77.05552622493516,38.868757801256,500 -77.05844056290393,38.86996206506943,500
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
</kml>
答案 1 :(得分:1)
听起来你正在创建2个2d多边形而不是3d多边形? 您可以创建常规的3d多边形:
http://code.google.com/apis/kml/documentation/kml_tut.html#polygons
然后检查KML中的altitudemode标签,使其“漂浮”在表面上方:
http://code.google.com/apis/kml/documentation/altitudemode.html