[OpenLayers-Users] problem labeling vector features - vertices
being labeled too
Michael Anderson
mike at spatialit.com
Wed Aug 19 10:42:57 EDT 2009
In the real app I'd tried setting the select style's label to an empty
string, but it didn't work so I didn't include it in my example. I added it
to the example (http://128.118.7.3/testing/testlabel.html). It makes the
label for the polygon go away, but still labels the vertices with
'undefined'.
Mike
----- Original Message -----
From: "Christopher Schmidt" <crschmidt at metacarta.com>
To: "Michael Anderson" <mike at spatialit.com>
Cc: <users at openlayers.org>
Sent: Wednesday, August 19, 2009 10:06 AM
Subject: SPAM-LOW: Re: [OpenLayers-Users] problem labeling vector features -
vertices being labeled too
On Wed, Aug 19, 2009 at 09:56:12AM -0400, Michael Anderson wrote:
> Hello,
>
> I'm having a problem with labeling vector features. It works fine until I
> select a feature with a ModifyFeature control. Then it labels all the
> vertices as well as the feature itself. And they are all labeled
> 'undefined'
> because the vertices don't have the attributes needed for the label.
>
> I have a stylemap set up with 'default' and 'select' styles. Only the
> default style has a label defined. At first I had a label set up for the
> select style too so it would be labeled when selected. Then when the
> vertices were labeled I removed the label from the style, but the vertices
> are still labeled.
"The “default” intent has a special role: if the extendDefault property
of the StyleMap is set to true (default), symbolizers calculated for
other render intents will extend the symbolizer calcualated for the
“default” intent. So if we want selected features just to have a
different size or color, we only have to set a single property (in this
example: pointRadius)."
-- http://docs.openlayers.org/library/feature_styling.html#stylemap
So, if you have (in your select style) the 'label' set to '' -- an empty
string -- I think this should solve your problem.
> Is there a way to label a feature while it's vertices are visible and not
> have the vertices labeled too?
Vertices are features too, but I think the above solution should solve
your problem, based on your description.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list