"Only a single root feature allowed within <kml> tag" error with KML code - kml

I have a working KML code displaying GPS'd surveyor markers on property boundary nominally coinciding with a town line. Now I want to do something a little more advanced:
Center the whole earth view over the place in question.
Draw the town line segment (a straight line connecting two corners ~10 km apart (which I had to change to a line connecting points 200 meters apart to stop the line from disappearing in hilly terrain when zooming in), automatically zooming in to a frame representing about 12 km high around the 10 km line, with a viewpoint elevation of 20 km.
Pause a few seconds.
Mark the GPS'd survey markers (using standard icons) and zoom in further to the shorter section of the town line framing my GPS'd markers (LookAt, 3700 meters range)
From this viewpoint, let my users manually navigate, zoom on individual marker icons, click on them for descriptions, etc. etc.
When I try to reorganize my code to add these stages, I get a message: "failed: Only a single root feature allowed within tag".
What am I doing wrong, and how should I be coding this?
Synopsis of code:
<?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">
<name>MHT-State boundary issues</name>
<!-- icons for historic stone corner monuments -->
<Style id="P.Star">
<IconStyle>
<Icon>
<href>
http://maps.google.com/mapfiles/kml/paddle/purple-stars-lv.png
</href>
<scale>0.25</scale>
</Icon>
</IconStyle>
</Style>
<!-- define blue(boundary) line between corners -->
<Style id="BlueLine">
<LineStyle>
<color>ffff0072</color>
<width>1</width>
</LineStyle>
</Style>
<!-- locate corners -->
<Placemark>
<name>B-H-R corner</name>
<styleUrl>#P.Star</styleUrl>
<description>Blandford-Hungtington-Russell corner, coordinates per MassDOT</description>
<Point><coordinates>-72.872182,42.216453</coordinates></Point>
</Placemark>
<Placemark>
<name>B-G-R corner</name>
<styleUrl>#P.Star</styleUrl>
<description>Blandford-Granville-Russell corner, coordinates per MassDOT</description>
<Point><coordinates>-72.895662,42.123925</coordinates></Point>
</Placemark>
<!-- draw town line between them -->
<Placemark>
<name>Blandford-Russell boundary</name>
<styleUrl>#BlueLine</styleUrl>
<LineString>
<tessellate>1</tessellate>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>
-72.895662,42.123925,0
-72.895622,42.124,0
... (more intermediate coordinates in straight line)
-72.872182,42.216453,0
</coordinates>
</LineString>
</Placemark>
<!-- set wide viewpoint to see boundary from Granville to Huntington corners -->
<LookAt>
<longitude>-72.884</longitude>
<latitude>42.171</latitude>
<range>20000</range>
</LookAt>
<!-- pause 5 seconds -->
<gx:Wait>
<gx:duration>5</gx:duration>
</gx:Wait>
<!-- add legend -->
<ScreenOverlay>
<name>Boundary Legend</name>
<overlayXY x="0" y="0" xunits="fraction" yunits="fraction"/>
<screenXY x="0" y="0.1" xunits="fraction" yunits="fraction"/>
<rotationXY x="0" y="0" xunits="fraction" yunits="fraction"/>
<size x="0" y="0" xunits="fraction" yunits="fraction"/>
<Icon><href>files\BndyLegend.png</href></Icon>
</ScreenOverlay>
<!-- define yellow line for first Hull/DFW boundary segment -->
<Style id="YellowLine">
<LineStyle>
<color>FF14F0FF</color>
<width>1</width>
</LineStyle>
</Style>
<!-- icon styles
purple (P.) - before 1950
red (R.) - 1950-1999
green (G.) - 2000-2013
yellow (Y.) - 2014 on
white (W.) - uncertain
star (.Star) - end monument
diamond (.Dmnd) - waypoint stone/concrete monument
circle (.Cir) - pipe set in ground, stones or concrete
square (.Sq) - blaze
blank (.blnk) - blank
-->
<!-- icons for historic waypoint stone monuments -->
<Style id="P.Dmnd">
<IconStyle>
<Icon>
<href>
http://maps.google.com/mapfiles/kml/paddle/purple-diamond-lv.png
</href>
<scale>0.25</scale>
</Icon>
</IconStyle>
</Style>
... (more styles)
<!-- pre-GPS town line marker, Route 23, #2 -->
<Placemark>
<name>2</name>
<styleUrl>#P.Dmnd</styleUrl>
<description>old town line monument by state route 23, by Garmin eTrex</description>
<Point><coordinates>-72.88422,42.17023</coordinates></Point>
</Placemark>
... (more point placemarks)
<!-- set viewpoint directly over #7, from 3700 meters up -->
<LookAt>
<longitude>-72.879562</longitude>
<latitude>42.1872075</latitude>
<range>3700</range>
</LookAt>
</Document>
</kml>
What happens:
Initial view of globe, without rotation or zoom appears, then this window pops up:
"Open of file "C:\Users\DTM\Documents\MHT\abutting state parcel\boundary KML\Boundary GPS.kml" failed: Only a single root feature allowed within tag"

You're missing the <Document> tag near the top of your file. You already have the closing </Document> tag near the end, but seem to be missing the opening one, which should go between the <kml...> tag and the first <name> tag. So your file should have this structure:
<?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">
<Document>
<name>MHT-State boundary issues</name>
...
</Document>
</kml>
For background, every KML must contain only one top-level element inside the <kml>...</kml> tags. That can either be ONE feature (like a Placemark, etc.) or it can be one "container": either a Document or Folder. So if you have a KML that will contain more than one Feature (or Style, etc.), then you need to wrap everything in at least one level of Document or Folder.

From the documentation:
A basic element contains 0 or 1 Feature and 0 or 1 NetworkLinkControl:
<kml xmlns="http://www.opengis.net/kml/2.2">
<NetworkLinkControl> ... </NetworkLinkControl>
<!-- 0 or 1 Feature elements -->
</kml>
A Feature Element is a single Placemark or a Document or Folder (either of which can contain multiple Placemarks):
<Feature>
Syntax
<!-- abstract element; do not create -->
<!-- Feature id="ID" --> <!-- Document,Folder,
NetworkLink,Placemark,
GroundOverlay,PhotoOverlay,ScreenOverlay -->
Document:
<Document>
Syntax
<Document id="ID">
<!-- inherited from Feature element -->
...
<!-- specific to Document -->
<!-- 0 or more Schema elements -->
<!-- 0 or more Feature elements -->
</Document>
Folder:
<Folder>
Syntax
<Folder id="ID">
<!-- inherited from Feature element -->
<name>...</name> <!-- string -->
...
<!-- specific to Folder -->
<!-- 0 or more Feature elements -->
You need to put your <Placemark> tags inside <Document> or <Folder> tag.

Related

KML polygon, altitude mode destroys color

I am attempting to generate a KML overlay. I have a grid I am mapping over an area, with colored squares. When I have the altitude mode as 'clampToGround' everything about the polygons I am generating, including their color, works as expected. However, it's not desirable to have the grid deform to map to the ground. When I change the altitude mode such that the overlay hovers a few meters off the ground, the shape of the grid sections is correct, but the color information is discarded and the grid sections are colored black.
Here is a testable excerpt of my KML code. Here is shows the colors correct but the grid deformed to the ground. Changing the value of altitudeMode to:
absolute produces the other behavior.
Is there a way to have this at the correct altitude AND with the correct color at the same time?
<?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">
<Document id="1">
<Document id="2">
<Style id="10">
<PolyStyle id="10">
<color>0xFF0000FF</color>
<colorMode>normal</colorMode>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<name>Antenna Data</name>
<Camera>
<longitude>-122.30201334502573</longitude>
<latitude>37.87244901754293</latitude>
<altitude>200</altitude>
</Camera>
<Placemark id="5">
<name>region</name>
<styleUrl>#10</styleUrl>
<Polygon id="4">
<altitudeMode>clampToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing id="8">
<coordinates>-122.30243999999999,37.871973499999996,10 -122.30243999999999,37.8719265,10 -122.30238,37.8719265,10 -122.30238,37.871973499999996,10</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
</Document>
</kml>
Your KML has several issues.
The polygon is missing the closing vertex. In order to be a valid KML polygon, the first coordinate set (lon,lat,alt) must be repeated as the last coordinate set, so that the polygon closes itself. For your example of a square, you would need 5 coordinate sets, with the first and the last being the same.
Try fixing that first, and if you still see coloring issues, try making sure that the vertex winding direction is correct (anti-clockwise). If it's backwards, then the darker "bottom" of the polygon will be facing upwards, and might appear dark/black. Yours appears correct from looking at the coordinates, but I could be mistaken.
Also, your color is not a valid KML color, as it appears to have an extra "0x" in front. A valid KML color needs four two-character values (each between 00 and ff), representing Alpha, Blue, Green, Red (AABBGGRR, and yes, it's backwards from HTML colors). A solid red would be: FF0000FF.
Below is an updated copy of your KML sample with altitudeMode = absolute, the closing vertex added, and the color corrected... this works for me in Earth Pro.
<?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">
<Document id="1">
<Document id="2">
<Style id="10">
<PolyStyle id="10">
<color>FF0000FF</color>
<colorMode>normal</colorMode>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<name>Antenna Data</name>
<Camera>
<longitude>-122.30201334502573</longitude>
<latitude>37.87244901754293</latitude>
<altitude>200</altitude>
</Camera>
<Placemark id="5">
<name>region</name>
<styleUrl>#10</styleUrl>
<Polygon id="4">
<altitudeMode>absolute</altitudeMode>
<outerBoundaryIs>
<LinearRing id="8">
<coordinates>-122.30243999999999,37.871973499999996,10 -122.30243999999999,37.8719265,10 -122.30238,37.8719265,10 -122.30238,37.871973499999996,10 -122.30243999999999,37.871973499999996,10</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
</Document>
</kml>
The solution I came across was that I could simple de-activate terrain in Google Earth. This seems to work now.

Displaying vectors with origin and direction in Google Earth

Would like to display direction vectors at defined locations in Google Earth. In a 3D tool direction vectors differ from a position vector (i.e. 2 geographical points connected via a line) that the displayed size is independant of the zoom level, just dependant on the aspect angle (projection).
Side mote: Finally I would like to display 3 direction vectors which span a orthoganal coordinate frame. So each "vector" would point in 3D Space.
Any solution existing? Or any idea of workaround for it?
I am familiar with KML and already reached my first goal to display a ground track and to highlight areas of interests using polygons. However I have found no solution for my request.
You can create points with icon images that look like an arrow, and rotate them with the appropriate tags, like in the KML below. Try copy/pasting that into Earth Pro.
Note that in this example I used an easily available icon where the arrow points down, but you might want to use your own where the arrow points up, so that the icon heading matches the compass angle. Also, you can play with the icon hotspot tag, to define what part of the icon image is anchored at your point's lat/lon. In this case I used the center of the image, but you could use the origin or tip of the arrow if you wanted.
<?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>arrow icons with headings</name>
<Placemark>
<name>heading: 0</name>
<Style>
<IconStyle>
<scale>3</scale>
<heading>0</heading>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/arrow.png</href>
</Icon>
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
</IconStyle>
</Style>
<Point>
<coordinates>-90,38</coordinates>
</Point>
</Placemark>
<Placemark>
<name>heading: 75</name>
<Style>
<IconStyle>
<scale>3</scale>
<heading>75</heading>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/arrow.png</href>
</Icon>
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
</IconStyle>
</Style>
<Point>
<coordinates>-85,38</coordinates>
</Point>
</Placemark>
<Placemark>
<name>heading: 150</name>
<Style>
<IconStyle>
<scale>3</scale>
<heading>150</heading>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/arrow.png</href>
</Icon>
<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
</IconStyle>
</Style>
<Point>
<coordinates>-80,38</coordinates>
</Point>
</Placemark>
</Document>
</kml>

How do you make the color or shading on a polygon constant in kml?

I'd like to display spatial data in Google Earth and I think the best way to do it is with polygons. I'd like both the height of a polygon as well as its color to both represent the data. The height is no problem, but I can't figure out how to force the polygon to have a constant color and/or shading. If I set a polygon's color to blue (FFFF0000), it appears light blue when viewed from one direction, but dark blue from another. For example, in the code below I have two polygons at 90 degrees to each other. Both of them should be the same color. However, when viewed in Google Earth, they clearly have a different color (or perhaps just different shading because they are at a different angle with respect to the viewer). Presumably this is by design, but I'd like to make polygons that have a constant color (or shading), irrespective of viewing angle. Does anybody know if this can be done?
Thanks
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
<Document>
<name>kml toolbox tests</name>
<Folder>
<name>kml.poly3</name>
<id>kml.poly3</id>
<Placemark id="kml_poly3tpfc275749_9c60_474d_b419_d29a903da8be">
<name>30</name>
<visibility>1</visibility>
<description/>
<Style>
<LineStyle>
<color>FFFFFFFF</color>
<width>5</width>
</LineStyle>
<PolyStyle>
<color>FFFF0000</color>
</PolyStyle>
</Style>
<Polygon id="Polygon_kml_poly3tpfc275749_9c60_474d_b419_d29a903da8be">
<extrude>0</extrude>
<tesselate>1</tesselate>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing id="LinearRing_kml_poly3tpfc275749_9c60_474d_b419_d29a903da8be">
<coordinates>-111.98,40.6,0
-111.97,40.6,0
-111.97,40.6,1500
-111.99,40.6,1500
-111.99,40.6,0 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark id="kml_poly3tpb12d0de1_b554_45ed_b9fd_63d120582f23">
<name>31</name>
<visibility>1</visibility>
<description/>
<Style>
<LineStyle>
<color>FFFFFFFF</color>
<width>5</width>
</LineStyle>
<PolyStyle>
<color>FFFF0000</color>
</PolyStyle>
</Style>
<Polygon id="Polygon_kml_poly3tpb12d0de1_b554_45ed_b9fd_63d120582f23">
<extrude>0</extrude>
<tesselate>1</tesselate>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing id="LinearRing_kml_poly3tpb12d0de1_b554_45ed_b9fd_63d120582f23">
<coordinates>-111.97,40.6,0
-111.97,40.62,0
-111.97,40.62,2000
-111.97,40.6,2000
-111.97,40.6,0 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Camera id="ID">
<TimePrimitive>...</TimePrimitive>
<gx:ViewerOptions>
<option> name="camera" type="boolean"></option>
</gx:ViewerOptions>
<longitude>-111.94</longitude> <!-- kml:angle180 -->
<latitude>40.53</latitude> <!-- kml:angle90 -->
<altitude>7500</altitude> <!-- double -->
<heading>340</heading> <!-- kml:angle360 -->
<tilt>60</tilt> <!-- kml:anglepos180 -->
<roll>0</roll> <!-- kml:angle180 -->
<altitudeMode>absolute</altitudeMode>
</Camera>
</Folder>
</Document>
</kml>
This polygon shading issue is much worse on more recent versions of Google Earth. In recent versions a comment was added saying that now only one side of polygons is rendered so my next step will be to place polygons back to back with opposite point order rotation. This way, all polygons viewed from the sun angle direction can appear constantly shaded at least.
The KML standard as well as Google Earth doesn't allow you to specify advanced rendering options such shading options. The current Google Earth KML extensions do not allow this to be changed and setting slightly transparent color also has no effect.
If the viewing angle and the face of polygon are perpendicular to each other then the color is at maximum but as you the angle tilts and angle approaches 0 degrees then the color blackens. At less than 5-10 degrees the color is nearly completely black.
Only get uniform coloring if polygons are on the ground and view is looking straight down. That allows you to create heat map visualizations.
To request a new feature you can try the following steps:
Click "Send Feedback" under the Help menu and fill out a detailed
response to Google.
Start a discussion of the feature in the Google Earth forum.
Submit feature request via https://code.google.com/p/earth-issues/issues/list

Linking KML balloons

Big picture: I'm writing my own KMLs using a custom KML writer in C++. I have a set of placemarks that share some (not all) properties. Currently I store the shared properties as properties of the parent folder the placemarks reside in. These KMLs are viewed in Google Earth.
Users gain access to view this data using a BalloonStyle linked to the ExtendedData stored within each placemark/folder. The placemarks share a balloonstyle for their unique data, and the shared data is displayed using the parent folder's balloon style when they click on the folder in Google Earth.
I can't afford to duplicate the shared data in each placemark, which is why I store it in the parent folder.
Alternative 1: Is there any way to provide a user-clickable link to the parent folder's balloon within the child's balloon?
Alternative 2: Is it possible to display another Placemark/Feature's data in a placemark's info balloon?
As far as I know, both alternatives are impossible.
Edit: Simplified example code:
<?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>MyKml</name>
<Style id="Style8"> <!-- style for child point -->
<BalloonStyle>
<text>
Point: $[name]<br/>
Code: $[code]<br/>
Number of Points: $[numpts] <!-- Alt2: numpts belongs to the parent - this syntax is obviously wrong -->
Link to parent: $[parentid] <!-- Alt1: if I can't display the parent's properties, can I at least give a clickable link to it? -->
</text>
</BalloonStyle>
</Style>
<Style id="Style12"> <!-- style for parent folder -->
<BalloonStyle>
<text>
Point Group: $[name]<br/>
Number of Points: $[numpts]
</text>
</BalloonStyle>
</Style>
<Folder>
<name>Point Group 1</name>
<styleUrl>#Style12</styleUrl>
<ExtendedData>
<Data name="numpts">
<value>4</value>
</Data>
</ExtendedData>
<Placemark>
<name>PT1</name>
<styleUrl>#Style8</styleUrl>
<ExtendedData>
<Data name="code">
<value>TAT1</value>
</Data>
</ExtendedData>
<MultiGeometry>
<Point>
<coordinates>-121,47,110</coordinates>
</Point>
</MultiGeometry>
</Placemark>
<Placemark>
<name>PT2 - PT4</name>
<styleUrl>#Style8</styleUrl>
<ExtendedData>
<Data name="code">
<value>TAT2</value>
</Data>
</ExtendedData>
<MultiGeometry>
<Point>
<coordinates>-121.090,47.430,1224</coordinates>
</Point>
<Point>
<coordinates>-121.470,47.621,122</coordinates>
</Point>
<Point>
<coordinates>-121.990,47.121,122</coordinates>
</Point>
</MultiGeometry>
</Placemark>
</Folder>
</Document>
</kml>
Alternative 1: Is there any way to provide a user-clickable link to the parent folder's balloon within the child's balloon?
This is achieved using feature anchors where you can refer to and link to placemarks by its KML id using <a href="target"> in the description/balloon. If the target Feature has a LookAt or Camera element, the Feature is viewed from the specified viewpoint.
The href can be a fragment URL (that is, a URL with a # sign followed by a KML identifier).
You can also append an action to the URL with a semi-colon (;) and one of these qualifiers:
;flyto (default) - fly to the Feature
;balloon - open the Feature's balloon but do not fly to the Feature
;balloonFlyto - open the Feature's balloon and fly to the Feature
If you want to show the folder balloon from the point's you can update the BalloonStyle text as following and add "id" attribute to the Folder you want to refer to.
<Style id="Style8">
<BalloonStyle>
<text>
<![CDATA[
Point: $[name]<br/>
Code: $[code]<br/>
Number of Points: $[numpts]
<BR>Link to parent
]]>
</text>
</BalloonStyle>
</Style>
<Folder id="parent"> *** Must add "id" attribute to link to it ***
...
</Folder>
Alternative 2: Is it possible to display another Placemark/Feature's data in a placemark's info balloon?
Can't directly include metadata for another placemark in balloon of another but can link to it and switch to showing other's balloon by user clicking the link.
You could add links to the description of the placemarks to link to one another in the same way to link to Folder by its id then add $[description] place holder to the BalloonStyle text.
<Style id="style9"> <!-- style for child point -->
<BalloonStyle>
<text>
<![CDATA[
Point: $[name]<br/>
Code: $[code]<br/>
Link to parent
<br>$[description]
]]>
</text>
</BalloonStyle>
</Style>
...
<Placemark id="pt1">
...
</Placemark>
<Placemark id="pt2">
<name>PT2 - PT4</name>
<description>
<![CDATA[
Show P1<BR>
]]>
</description>
<styleUrl>#style9</styleUrl>
...
</Placemark>

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>
KML does not allow multiple names/labels for geometries within a single Feature even using a Multi-geometry. If you have multiple points in a MultiGeometry then the same name of the feature will appear over all points. One Placemark point == one label so if you want different labels on map using KML then must have two Placemarks one at each end of the line.
Simple solution is to structure your KML with multiple Placemarks which you can hide in a Document/Folder using the checkHideChildren listItemType. Then it appears in the Places panel in Google Earth as a single "feature" but multiple name labels display on the map as you want. The trick here is that the Folder name appears in the Places Panel and the Placemark names appear as labels on the map.
The following example illustrates such a KML file.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Example</name>
<open>1</open>
<Style id="hide">
<ListStyle>
<listItemType>checkHideChildren</listItemType>
</ListStyle>
</Style>
<Folder>
<name>TEST1</name>
<styleUrl>#hide</styleUrl>
<Placemark>
<name>TEST1</name>
<MultiGeometry>
<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>
<Placemark>
<name>TEST2</name>
<Point>
<coordinates>-3.6655,40.4364</coordinates>
</Point>
</Placemark>
</Folder>
</Document>
</kml>
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>
A user can't see 40,000 placemarks at once. Take a look at some of the provided Earth Gallery pages like FlightWise (http://mw1.google.com/mw-weather/flightwise/pointer.kml) to see how they use NetworkLink, Region, and Lod tags to split up their data set and present the correct data to the correct view at the correct time.

Resources