分享地标说明

时间:2018-04-05 17:47:57

标签: kml google-earth

我创建了一个地质单位地图。每个地质单元由多个地标多边形组成。我目前在组成地质单元的每个地标中重复相同的地质单位描述,以获得我想要的功能(点击多边形并获得描述)。

有没有办法在KML文件中包含一次地质单位描述并在多个多边形上使用它?

以下是我目前所拥有的一个例子:

<?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>Geologic Units</name>
    <open>1</open>
    <Style id="style22">
        <LineStyle>
            <color>40000000</color>
        </LineStyle>
        <PolyStyle>
            <color>996ca66c</color>
        </PolyStyle>
    </Style>
    <Folder>
        <name>Cokeville Formation (Lower Cretaceous)</name>
        <Placemark>
            <name>Cokeville Formation</name>
            <description><![CDATA[<p>UNITSYMBOL: Kc</p><p>UNITNAME: Cokeville Formation</p><p>AGE: Lower Cretaceous</p><p>Description: Interbedded dark-gray, carbonaceous, shaly mudstone and siltstone, tan-weathering sandstone, and gray to tan limestone and coquina containing gastropod (Pyrgulifera) and pelecypod fauna. hickness about 650 m. Mapped only along southeastern edge of map area</p>]]></description>
            <styleUrl>#style22</styleUrl>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <tessellate>1</tessellate>
                        <coordinates>
                            -111.001621832,41.6548237803,0 -111.000744207,41.6560784513,0 -111.00074419,41.6548059965,0 -111.001123716,41.6547959594,0 -111.001621832,41.6548237803,0 
                        </coordinates>
                    </LinearRing>
                </outerBoundaryIs>
            </Polygon>
        </Placemark>
        <Placemark>
            <name>Cokeville Formation</name>
            <description><![CDATA[<p>UNITSYMBOL: Kc</p><p>UNITNAME: Cokeville Formation</p><p>AGE: Lower Cretaceous</p><p>Description: Interbedded dark-gray, carbonaceous, shaly mudstone and siltstone, tan-weathering sandstone, and gray to tan limestone and coquina containing gastropod (Pyrgulifera) and pelecypod fauna. hickness about 650 m. Mapped only along southeastern edge of map area</p>]]></description>
            <styleUrl>#style22</styleUrl>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <tessellate>1</tessellate>
                        <coordinates>
                            -111.010074925,41.6544088836,0 -111.009817106,41.6540759648,0 -111.009537791,41.6538429717,0 -111.009365835,41.6535267043,0 -111.009150955,41.6532271007,0 -111.008914576,41.653010725,0 -111.008549317,41.6527943596,0 -111.00861367,41.6521452029,0 -111.008506241,41.6516790986,0 -111.008466501,41.6515573391,0 -111.009350608,41.6513600036,0 -111.01081154,41.6510769006,0 -111.011498939,41.6510102244,0 -111.011406521,41.6517787096,0 -111.011019912,41.6519285808,0 -111.010590221,41.6523613799,0 -111.01028951,41.6528275229,0 -111.010246703,41.6535765651,0 -111.010160817,41.6540093659,0 -111.010074925,41.6544088836,0 
                        </coordinates>
                    </LinearRing>
                </outerBoundaryIs>
            </Polygon>
        </Placemark>
    </Folder>
</Document>
</kml>

2 个答案:

答案 0 :(得分:0)

我想出了如何使用BalloonStyle Text。这是唯一的方式还是有其他/更好的方式?

<?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>Geologic Units</name>
    <open>1</open>
    <Style id="style22">
        <BalloonStyle>
            <text><![CDATA[<p>UNITSYMBOL: Kc</p><p>UNITNAME: Cokeville Formation</p><p>AGE: Lower Cretaceous</p><p>Description: Interbedded dark-gray, carbonaceous, shaly mudstone and siltstone, tan-weathering sandstone, and gray to tan limestone and coquina containing gastropod (Pyrgulifera) and pelecypod fauna. hickness about 650 m. Mapped only along southeastern edge of map area</p>]]></text>
        </BalloonStyle>
        <LineStyle>
            <color>40000000</color>
        </LineStyle>
        <PolyStyle>
            <color>996ca66c</color>
        </PolyStyle>
    </Style>
    <Folder>
        <name>Cokeville Formation (Lower Cretaceous)</name>
        <Placemark>
            <name>Cokeville Formation</name>
            <styleUrl>#style22</styleUrl>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <tessellate>1</tessellate>
                        <coordinates>
                            -111.001621832,41.6548237803,0 -111.000744207,41.6560784513,0 -111.00074419,41.6548059965,0 -111.001123716,41.6547959594,0 -111.001621832,41.6548237803,0 
                        </coordinates>
                    </LinearRing>
                </outerBoundaryIs>
            </Polygon>
        </Placemark>
        <Placemark>
            <name>Cokeville Formation</name>
            <styleUrl>#style22</styleUrl>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <tessellate>1</tessellate>
                        <coordinates>
                            -111.010074925,41.6544088836,0 -111.009817106,41.6540759648,0 -111.009537791,41.6538429717,0 -111.009365835,41.6535267043,0 -111.009150955,41.6532271007,0 -111.008914576,41.653010725,0 -111.008549317,41.6527943596,0 -111.00861367,41.6521452029,0 -111.008506241,41.6516790986,0 -111.008466501,41.6515573391,0 -111.009350608,41.6513600036,0 -111.01081154,41.6510769006,0 -111.011498939,41.6510102244,0 -111.011406521,41.6517787096,0 -111.011019912,41.6519285808,0 -111.010590221,41.6523613799,0 -111.01028951,41.6528275229,0 -111.010246703,41.6535765651,0 -111.010160817,41.6540093659,0 -111.010074925,41.6544088836,0 
                        </coordinates>
                    </LinearRing>
                </outerBoundaryIs>
            </Polygon>
        </Placemark>
    </Folder>
</Document>
</kml>

答案 1 :(得分:0)

对于您的用例,包含气球模板的BalloonStyle的共享样式可能是最好的方法。您可以更进一步,在BalloonStyle模板中包含占位符变量,它将被每个地标中的ExtendedData部分的内容替换。也就是说,另一种方法是使用MultiGeometry将相关多边形组合成一个地标,但前提是您希望组合多边形在地图上作为一个多边形。