Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It looks like KMLViewer can only handle one <code>LineString</code> object per <code>Placemark</code>.</p> <p>For the route you tried, Google is returning two LineString objects in the "Route" Placemark (the last one in the file). KMLViewer only displays the second (last) LineString segment.</p> <p>Aside from updating the KMLViewer code to add support for multiple LineString objects per Placemark (which looks like a good exercise), you can try these two workarounds:</p> <p>Combine the coordinates from the two LineString objects into one LineString. Change:</p> <pre><code>&lt;Placemark&gt; &lt;name&gt;Route&lt;/name&gt; &lt;description&gt;some cdata stuff here&lt;/description&gt; &lt;GeometryCollection&gt; &lt;LineString&gt;&lt;coordinates&gt;coord1 … coordN&lt;/coordinates&gt;&lt;/LineString&gt; &lt;LineString&gt;&lt;coordinates&gt;coordN+1 … coordK&lt;/coordinates&gt;&lt;/LineString&gt; &lt;/GeometryCollection&gt; &lt;styleUrl&gt;#roadStyle&lt;/styleUrl&gt; &lt;/Placemark&gt; </code></pre> <p>To this:</p> <pre><code>&lt;Placemark&gt; &lt;name&gt;Route&lt;/name&gt; &lt;description&gt;some cdata stuff here&lt;/description&gt; &lt;GeometryCollection&gt; &lt;LineString&gt;&lt;coordinates&gt;coord1 … coordN coordN+1 … coordK&lt;/coordinates&gt;&lt;/LineString&gt; &lt;/GeometryCollection&gt; &lt;styleUrl&gt;#roadStyle&lt;/styleUrl&gt; &lt;/Placemark&gt; </code></pre> <p>The above might only make sense for routes (line segments) that are supposed to be continuous.</p> <p>Another workaround is to split the "Route" Placemark into multiple placemarks (one for each LineString):</p> <pre><code>&lt;Placemark&gt; &lt;name&gt;Route A&lt;/name&gt; &lt;description&gt;some cdata stuff here&lt;/description&gt; &lt;GeometryCollection&gt; &lt;LineString&gt;&lt;coordinates&gt;coord1 … coordN&lt;/coordinates&gt;&lt;/LineString&gt; &lt;/GeometryCollection&gt; &lt;styleUrl&gt;#roadStyle&lt;/styleUrl&gt; &lt;/Placemark&gt; &lt;Placemark&gt; &lt;name&gt;Route B&lt;/name&gt; &lt;description&gt;some cdata stuff here&lt;/description&gt; &lt;GeometryCollection&gt; &lt;LineString&gt;&lt;coordinates&gt;coordN+1 … coordK&lt;/coordinates&gt;&lt;/LineString&gt; &lt;/GeometryCollection&gt; &lt;styleUrl&gt;#roadStyle&lt;/styleUrl&gt; &lt;/Placemark&gt; </code></pre> <p>One issue with this is that the "description" which contains distance and time info will not match the split routes.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload