Search code examples
azure-maps

Azure Maps - How to increase the max text size/avoid word wrap?


When I create a symbol layer the text field is wrapped if the text becomes too long. I'm not able to figure out why/when the text is to long. It seems to depend on different things e.g. font type, text size and text length.

I tested the text length by using this example code. I replace Cafeteria with the alphabet with space between each character. It then wraps to a second line between m and n and that's to few letters on one line for our use case. https://azuremapscodesamples.azurewebsites.net/Symbol%20Layer/Formatted%20text%20field.html

I have been working with mapbox. They have a setting "text-max-width" that solves this issue. I have checked the javascript code that comes with the npm package azure-maps-control and it doesn't implement support for "text-max-width".

Do anyone know how to fix the wrapping issue or if the package azure-maps-control are going to implement support for the "text-max-width" setting?


Solution

  • There is no option for this today, but I've added it to the feature request list. As a work around, you could do the following:

    var layer = new atlas.layer.SymbolLayer(datasource);
    
    map.map.setPaintProperty(layer.getId(), 'text-max-width', 15);