[OpenLayers-Users] Retrieving label width
Nuno Magalhães
nuno.magalhaes at inov.pt
Mon Dec 3 01:39:55 PST 2012
Hi Slawomir,
I'm using something similar to measureText function but the result width is
always shorter than the label.
Slawomir Messner wrote
> 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 .osgeo
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>
>
> --
> --------------------------------------------------
> Slawomir Messner
> Forschungszentrum "Deutscher Sprachatlas"
> 06421-28-24981
>
> _______________________________________________
> Users mailing list
> Users at .osgeo
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Retrieving-label-width-tp5019813p5020289.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list