A question for KML openlayers people. I am trying to display KML placemarks
to show in openlayers with both the icon and placemark. So far I can only
get one or the other to show.

I have a style map:

var myStyles = new OpenLayers.StyleMap({
   "default": new OpenLayers.Style({
      label: "${name}"
   }),
});


When I have extractStyles set to false, the text label displays but no icon.
A demo is here:
http://timsc.dev.openstreetmap.org/dev/kmllabel/noextract.html

var kmltest = new OpenLayers.Layer.Vector("KML", {
   styleMap: myStyles,
          strategies: [new OpenLayers.Strategy.Fixed()],
          protocol: new OpenLayers.Protocol.HTTP({
             url: "test.kml",
             format: new OpenLayers.Format.KML({
                extractAttributes: true
                extractStyles: false,
            })
          })
   });

When I have extractStyles set to true, the icon displays but no text. Demo:
http://timsc.dev.openstreetmap.org/dev/kmllabel/extract.html

var kmltest = new OpenLayers.Layer.Vector("KML", {
   styleMap: myStyles,
          strategies: [new OpenLayers.Strategy.Fixed()],
          protocol: new OpenLayers.Protocol.HTTP({
             url: "test.kml",
             format: new OpenLayers.Format.KML({
                extractAttributes: true
                extractStyles: true,
             })
          })
   });

Any idea if I can get both the text label and icon to display? The original
KML is here: http://timsc.dev.openstreetmap.org/dev/kmllabel/test.kml

I don't know if this is relevant but this bug seems to be somewhat relevant,
in terms of the current openlayers behaviour:
http://trac.osgeo.org/openlayers/ticket/2441

Thanks,

TimSC

-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/KML-layer-with-both-icon-and-text-label-tp5778061p5778061.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to