openlayers/ol-mapbox-style

missing icon-text-fit property

joostschouppe opened this issue · 2 comments

I used Maputnik to make labels where a white block is stretched to fit the label of some objects

"icon-image": "a_white_block",
"icon-text-fit": "both",
"icon-text-fit-padding"

If I understand #10 (comment) correctly, it's normal that this does not render properly in our OpenLayers project, since those two last properties are not supported.
Is there a workaround for this? Is there a plan to implement more properties? Would you welcome pull requests to fix this (and if so, can you point us in the right direction as to where to start with a fix)?

And the same questions for symbol-placement, which we use to put labels along a line

First of all for the easy part of the answer: symbol-placement has been implemented in the meantime.

icon-text-fit and icon-text-fit-padding are still not implemented, but pull requests are welcome! A good approach would be to measure the text with the wrapText function provided in src/text.js (by adding an optional last argument and returning text and box measurements, if provided), and use that measurement to scale the icon.

Thanks for the info!
This is few skyscrapers above my own level, but I'll try to push for some time in our team, though it's likely it's not for this year