如何在 KML 中创建位于空中的多边形形状?

发布于 2024-08-20 10:04:08 字数 152 浏览 2 评论 0原文

我需要能够将给定高度的多边形对象放入位于地面上方的 KML 中。我希望将空域信息显示到 KML 中,每个空域都有一个低海拔和高海拔值。

到目前为止,我能做的最接近的事情是创建两个具有不同高度的多边形来显示空域,但我无法连接多边形来显示中间区域。

感谢您的帮助

I need to be able to place a polygon object with a given height into a KML that will be located above the ground. I'm looking to display airspace information into a KML and each airspace has a low altitude and and high altitude value.

The closest thing I have been able to do so far is to create two polygons with different altitudes to show the airspace but I have no way of connecting the polygons to show the middle area.

Thanks for your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

羁〃客ぐ 2024-08-27 10:04:08

您有两个选择,您可以创建空气空间的 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>

Your have two options, you can create a collada model of the air space, or a series of polygon objects defining each face,

verticly oriented polygons can be defined, be take note of the direction of your (clockwise or counter clockwise) as this will effect the style, viewing a polygon from the bottom makes it slightly darker

for a simple rectancular shape you will need 6 faces

the following kml is a modified version of the pentagon example with one of the verticle faces filled in, the other 4 verticle faces need to be complete, but you'll get the idea.

    <?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>
蔚蓝源自深海 2024-08-27 10:04:08

听起来您正在创建 2 个 2d 多边形而不是 3d 多边形?
您可以创建常规 3D 多边形:

http://code.google。 com/apis/kml/documentation/kml_tut.html#polygons

然后查看 KML 中的海拔模式标记,使其“漂浮”在表面上方:

http://code.google.com/apis/kml/documentation/altitudemode.html

It sounds like you are creating 2 2d polygons rather than a 3d one?
You could create a regular 3d polygon:

http://code.google.com/apis/kml/documentation/kml_tut.html#polygons

Then check out the altitudemode tag in KML to "float it" above the surface:

http://code.google.com/apis/kml/documentation/altitudemode.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文