You can create two images for your features one with background color red
and one with green. Then switch the graphics dynamically.

 

If (I need redbackground){

       myfeatureStyle.externalGraphic: imgRedBackground;

 

}else{

      myfeatureStyle.externalGraphic: imgGreenBackground;

}

 

OR:

       

You can also not use graphics and use the basic feature point symbology such
as a circle, square, X and so on. This way you can change the color
dynamically to any color you want without having premade graphic images made
out.

 

This is an example of two point features symbolized as circles with a
numeric label. (no externalGraphic).



 

 

 

From: jkm [mailto:[email protected]] 
Sent: Friday, February 17, 2012 12:53 PM
To: Carlos Krefft
Cc: [email protected]
Subject: Re: [OpenLayers-Users] Drawing a point feature with image and
background color..

 

Ohps sorry! You are right! I made a confusing question.. 

 

What I would like.. is draw only one feature.. 

This feature should represent the kind of item (represented by the
externalGraphic) and how much critical is the item (represented by
background color from green to red).. 

 

By now, i'm drawing in two separate features on the same position (One with
externalgraphic, and the other with fillColor).. But I'm doing in this way,
because i can't find the way to draw a unique feature..

 

You can see that my english is not as good as i would like..  :)

 

Thanks again..!

 

 

 

 

2012/2/17 Carlos Krefft <[email protected]>

"I'm drawing features with images defined by the externalGraphic property..
Then.. I can't use the fillColor.. ?"

 

You cannot use fillColor with an externalGraphic as it says in the
documentation . But your original question states you will be using TWO
features "I'm drawing two elements in the same position".

 

So use fillColor for your background feature and externalGraphic for your
foreground feature.

 

"Or is there any other way to draw the feature withous using
externalGraphic?"

 

Yes, you can simply omit the externalGraphic and the feature will draw
without the a graphic, just with the style.

 

Carlos K.

 

 

 

From: jkm [mailto:[email protected]] 
Sent: Friday, February 17, 2012 12:08 PM
To: Carlos Krefft
Cc: [email protected]
Subject: Re: [OpenLayers-Users] Drawing a point feature with image and
background color..

 

Uhm..

 

But.. as seen in this link..

http://docs.openlayers.org/library/feature_styling.html 

 

"fillColor

Default is #ee9900. This is the color used for filling in Polygons. It is
also used in the center of marks for points: the interior color of circles
or other shapes. It is not used if an externalGraphic is applied to a
point."

 

I'm drawing features with images defined by the externalGraphic property..
Then.. I can't use the fillColor.. ?

 

Or is there any other way to draw the feature withous using externalGraphic?

 

Thanks...

 

 

2012/2/17 Carlos Krefft <[email protected]>

Here are the possible values:

 

http://docs.openlayers.org/library/feature_styling.html#style-properties

 

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Carlos Krefft
Sent: Friday, February 17, 2012 11:40 AM
To: 'jkm'; [email protected]
Subject: RE: [OpenLayers-Users] Drawing a point feature with image and
background color..

 

Use fillColor.

.

fillColor: "#FF5500",

fillOpacity: 0.7,

.

 

Carlos K.

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of jkm
Sent: Friday, February 17, 2012 5:58 AM
To: [email protected]
Subject: [OpenLayers-Users] Drawing a point feature with image and
background color..

 

Hi, 

 

I would like to know if it is possible to draw a point feature with a
background color..

 

I define a style like that:

 

ImgStyle = {

        externalGraphic: imgURL,

        label: text,

        labelXOffset: "0",

        labelYOffset: "-10",

        fontColor: txt_colfont,

        fontSize: "10px",

        fontFamily: "Arial",

        fontWeight: "bold",

        pointRadius: 10,

        labelAlign: "cm",

        labelPadding: "3px",

        labelBackgroundColor: txt_colback,

        labelBorderColor: "#cfcfcf",

        labelBorderSize: "1px"

    };

 

And what I would like to do, is draw a background to the image..

 

By now, I'm drawing two elements in the same position, one is the point with
the externalGraphic, and the other one is the same but without the
externalGraphic and with a background color.. With this I can see the effect
of a background under the image..

 

But, I would like to draw as a unique element... Because I'm loading a large
amount of markers to the map.

 

And also, I would like to apply a cluster strategy to the layer.. And
drawing the background and the image as separate features modifies the
clustering..

 

Thanks!

 

 

 

 

<<image001.png>>

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to