I've been using Apple's KMLViewer code to show tracks on my MKMapView. I create the KML files by saving a place from Google Earth as a KML file, but the tracks won't display in the map unless I change the style map in the KML file.
At the beginning of the KML file is the style map:
<Style id="lineStyle0000">
<LineStyle>
<color>ff0600ff</color>
<width>4</width>
</LineStyle>
</Style>
<StyleMap id="lineStyle11000">
<Pair>
<key>normal</key>
<styleUrl>#lineStyle0000</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#lineStyle01</styleUrl>
</Pair>
</StyleMap>
<Style id="lineStyle01">
<LineStyle>
<color>ff0600ff</color>
<width>4</width>
</LineStyle>
</Style>
And the track within the KML file starts with
<Placemark>
<name>Track01</name>
<visibility>0</visibility>
<styleUrl>#lineStyle11000</styleUrl>
<LineString>
<tessellate>1</tessellate>
<coordinates>...
When I run the app, the track doesn't show up at all. If I change the styleUrl tag in the beginning of the track from #lineStyle11000 to #lineStyle0000, it shows up fine. This is easy enough to do when I have one or two tracks to display, but it's an annoyance. When I have ten or fifteen tracks to display in one KML file, it really eats up some time.
Is there any way to avoid this problem? I keep all of my tracks in Google Earth so that I can manage them easily, but I'd like to not have to manually change the text of the file every time I need to put it in an app.
Thanks
The solution I've been using doesn't really fix the problem, but gets around it okay. Google Earth exports the kml file with the style maps, but if you send the kml file through GPSVisualizer with an output format of Google Earth KML, it just converts the entire file into the simpler format that Apple's KMLViewer can read, while keeping all the colors and line sizes.
Kind of a cop out, but it works.