[OpenLayers-Users] Label position on vector features

Andreas Hocevar ahocevar at opengeo.org
Mon Aug 10 08:36:07 EDT 2009


João Duarte wrote:
>
> Hi,
>
>  
>
> Can anyone say if such a patch would be incompatible with SLD?
>

To me it looks like this is exactly what the sld DisplacementX and
DisplacementY properties do.

If you want to have this in OpenLayers, please provide a patch
(preferably with unit tests and sld reader/writer). See
http://trac.openlayers.org/wiki/HowToContribute.

Thanks!
Andreas.

>  
>
> João Duarte
>
>  
>
> *De:* Arnd Wippermann [mailto:arnd.wippermann at web.de]
> *Enviada:* sábado, 8 de Agosto de 2009 10:30
> *Para:* Joao Campos Duarte (PRIMEIT)
> *Cc:* users at openlayers.org
> *Assunto:* AW: [OpenLayers-Users] Label position on vector features
>
>  
>
> Hi,
>
>  
>
> i do exactly the same to get the labels positioned. Otherwise the
> labels would hide the symbols for my point features. I would also like
> this patch, but I'm not sure, if it is compatible with SLD.
>
>  
>
> Arnd
>
>  
>
> ------------------------------------------------------------------------
>
> *Von:* users-bounces at openlayers.org
> [mailto:users-bounces at openlayers.org] *Im Auftrag von *Joao Duarte
> *Gesendet:* Freitag, 7. August 2009 20:30
> *An:* users at openlayers.org
> *Betreff:* [OpenLayers-Users] Label position on vector features
>
> Hi list,
>
>  
>
> Is there any way to position the label of a vector feature besides the
> labelAlign property?
>
>  
>
> I have a vector feature which is a point having an externalGraphic and
> what I really would like to do is to specify an offset the label
> should have relative to the feature centroid.
>
>  
>
> I checked the drawText method in the Renderers (VML and SVG) and they
> determine the position of the label by the feature centroid. But don’t
> let the user specify a custom offset.
>
>  
>
> Has anyone thought about this? A simple patch on the drawText method
> would do this:
>
>  
>
> var x = (location.x / resolution + this.left + style.labelOffsetX);
>
> var y = (location.y / resolution - this.top - style.labelOffsetY);
>
>  
>
> Am I right?
>
>  
>
> João Duarte
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list