[OpenLayers-Users] using external styles with OpenLayers.Format.KML

K Clair kclair at pickledradish.com
Mon Mar 28 11:44:46 EDT 2011


 hi,

 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?

 thanks,
 kristina


More information about the Users mailing list