[OpenLayers-Dev] can't show externalGraphics for vectors

Eric Lemoine eric.c2c at gmail.com
Thu Nov 22 12:26:45 EST 2007


On Nov 22, 2007 3:55 PM, Val Cartei <val.cartei at gmail.com> wrote:
> Hi there,
> I am trying to attach an image to a Point. The idea would be to extend
> the class so that the style with the attribute externalGraphic gets
> applied, but it doesn't seem to work.
> The problem is that it still shows the default style, although if i do
> an alert (style.externalGraphic), the property exists, it just doesn'y
> display.
>
> Here's my code:
> style_mark.externalGraphic = "http://boston.openguides.org/markers/AQUA.png";
>
>         var SinglePoint=OpenLayers.Class.create();
>         SinglePoint.prototype=OpenLayers.Class.inherit(OpenLayers.Handler.Point,{
>          createFeature:function(evt){
>            OpenLayers.Handler.Point.prototype.createFeature.apply(this);
>            this.point.style = OpenLayers.Util.extend({},style_mark);//style_mark;
>          }
>         });
>
> I hope someone can help me with this.

Maybe you don't have enough styling properties, can you try
this.point.style =
OpenLayers.Util.extend(OpenLayers.Feature.Vector.style["default"],
style_mark);

--
Eric



More information about the Dev mailing list