I\'ve been searching for quite sometime an answer to my problem with no success. So here it goes...
KMLViewer, Apple\'s example is not working in some cases. After e
It looks like KMLViewer can only handle one LineString
object per Placemark
.
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.
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:
Combine the coordinates from the two LineString objects into one LineString. Change:
Route
some cdata stuff here
coord1 … coordN
coordN+1 … coordK
#roadStyle
To this:
Route
some cdata stuff here
coord1 … coordN coordN+1 … coordK
#roadStyle
The above might only make sense for routes (line segments) that are supposed to be continuous.
Another workaround is to split the "Route" Placemark into multiple placemarks (one for each LineString):
Route A
some cdata stuff here
coord1 … coordN
#roadStyle
Route B
some cdata stuff here
coordN+1 … coordK
#roadStyle
One issue with this is that the "description" which contains distance and time info will not match the split routes.