[GIS] Label in the middle of linestring in OpenLayers

javascriptopenlayers-2

Is there anyone can put label in the middle of the linestring dynamically? I've used labelAlign option. I've changed this value from bc, cc, cm, etc. But it doesn't work at all. There's also option for x offset and y offset. But I don't know how to calculate the right position so the label can show at the middle of linestring. Not at the first line string.

Do you have any idea how to do it?

Thanks,

Best Answer

Check out this answer here may help you if u glance at the code.

i hope it helps you...

Related Question