[OpenLayers-Users] problem labeling vector features - vertices being labeled too

Christopher Schmidt crschmidt at metacarta.com
Wed Aug 19 10:06:12 EDT 2009


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