[OpenLayers-Users] Retrieving label width

Slawomir Messner slawomir.messner at staff.uni-marburg.de
Sun Dec 2 22:16:08 PST 2012


In my opinion, it is the easiest way to do it with a hidden div. It 
works fine for us and one more div on a website is not that overhead or 
memory problem if you're aware of not creating divs without destroy it 
again.
The textMetrics function is nice if you use jQuery:
http://stackoverflow.com/questions/118241/calculate-text-width-with-javascript

Am 03.12.2012 03:11, schrieb OpenGSC:
> I think you cann't  do it by OL.because the label width determind by your
> string length.
> but you can do it by yourself,the relationship about pixels and resolution
> or scale you ought to konw !
> how to calculate is very easy!
>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Retrieving-label-width-tp5019813p5020217.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>


-- 
--------------------------------------------------
Slawomir Messner
Forschungszentrum "Deutscher Sprachatlas"
06421-28-24981



More information about the Users mailing list