Search code examples
kml

Multigeometry with two points and different names in the points


I have a Multigeometry in KML but when I assign a name to the placemark, both points in my placemark have the same name. Is there any possibility to have different names for points in any placemark?

Here is an example of my code:

<Placemark>
    <name>TEST</name>
<description></description>
    <visibility>1</visibility>
    <tessellate>1</tessellate>
    <styleUrl>#StyTEST</styleUrl>
<MultiGeometry>
    <Point>
        <coordinates>-3.6655,40.4364</coordinates>
    </Point>
    <Point>
        <coordinates>-3.6726,40.4308</coordinates>
    </Point>
    <LineString>
        <tessellate>1</tessellate>
            <coordinates>
                -3.6655,40.4364
                -3.6726,40.4308
            </coordinates>
    </LineString>
</MultiGeometry>
</Placemark>

Solution

  • A Placemark has only one name. If you need to have each Point have its own name, they need to be separate Placemarks.

    From the referenced documentation:

    <Placemark>
    Syntax

    <Placemark id="ID">
    <!-- inherited from Feature element -->
    <name>...</name> <!-- string -->
    <visibility>1</visibility> <!-- boolean -->
    <open>0</open> <!-- boolean -->
    <atom:author>...<atom:author> <!-- xmlns:atom -->
    <atom:link href=" "/> <!-- xmlns:atom -->
    <address>...</address> <!-- string -->
    <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal -->
    <phoneNumber>...</phoneNumber> <!-- string -->
    <Snippet maxLines="2">...</Snippet> <!-- string -->
    <description>...</description> <!-- string -->
    <AbstractView>...</AbstractView> <!-- Camera or LookAt -->
    <TimePrimitive>...</TimePrimitive>
    <styleUrl>...</styleUrl> <!-- anyURI -->
    <StyleSelector>...</StyleSelector>
    <Region>...</Region>
    <Metadata>...</Metadata> <!-- deprecated in KML 2.2 -->
    <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 -->

    <!-- specific to Placemark element -->
    <Geometry>...</Geometry>
    </Placemark>