Displaying Multiline text in Azure maps

Satyam Chauhan 607 Reputation points
2022-02-17T14:49:34.61+00:00

We have CAD drawing with one unit layer and single line text unit label. In addition to this inside unit layer we have two CAD features (Rectangle and Circle) in the drawing. These features are having text which is multi line. On conversion to Azure map, we are able to see the unit layer with unit label and CAD features. But the multi lines inside CAD feature (Rectangle and Circle) is not appearing in map. Please let me know whether apart from unit labels all other labels inside CAD features should also be in single line for Azure maps. My understanding was that only for unit label and zone label single line text is mandatory. Kindly provide any pointers that can help.

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
831 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Brendan Co 746 Reputation points Microsoft Employee
    2022-02-22T17:19:36.263+00:00

    Hi @Anonymous ,

    The Conversion service only supports single line text for units and zones. Multiline text are not supported for any other layers. A warning is returned from Conversion for any multiline text is provided.

    For your multiline text, is this just a layer of text that you are trying to display or are you trying to associate this with some feature such as a unit?

    Thank

    1 person found this answer helpful.

  2. rbrundritt 20,836 Reputation points Microsoft Employee Moderator
    2022-02-17T15:36:58.31+00:00

    If you have a single line of text, having a \n in it should create a new line in the displayed label. Here is a simple example.

       var symbolLayer = new atlas.layer.SymbolLayer(datasource, null, {  
       textOptions: {  
       textField: "Hello\nWorld"  
       }  
       });  
       map.layers.add(symbolLayer);  
    

    If your string is a property in your features, say its call displayText you can set the textField option with ['get', 'displayText']

    If the two lines of text are split between two properties, you can use a text field expression to format this information as two lines in a symbol layer as documented here: https://learn.microsoft.com/en-us/azure/azure-maps/data-driven-style-expressions-web-sdk#text-field-format-expression


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.