I'm trying to move my kml styles to an external document for use with OpenLayers. The styles work when they are included directly in the kml file.
At first I thought I could use straight kml for this with the styleUrl tag:
<styleUrl>http://localhost/map.kml#myIcon</styleUrl>
However, when I try to do that, the map.kml file never gets requested, and the markers don't show up. I've verified that the styleUrl url works.
I'm loading my kml using:
new OpenLayers.Layer.GML('Name', 'kml_path', {
format: OpenLayers.Format.KML,
formatOptions: {
extractStyles: true,
extractAttributes: true
},
projection: map.displayProjection
});
There are some tantalizing options called 'styles' and 'styleBaseUrl' in the OpenLayers.Format.KML API, but I cannot find any documentation about what they are for or how to use them. Does anyone have any experience with these?