首页 > 解决方案 > Azure 室内地图显示单位替代名称 (nameAlt)

问题描述

我想问是否有办法在显示室内地图时显示单元的nameAlt而不是单元标签。

https://docs.microsoft.com/en-us/azure/azure-maps/drawing-package-guide 在绘图包指南中,它显示了单位标签,但我们如何也显示 nameAlt?

标签: azureazure-maps

解决方案


我还没有找到任何关于它的文档。但是,我发现 Azure Indoor Maps 使用Mapbox GL JS作为渲染引擎。出于这个原因,在 Azure Indoor Maps 有更多文档之前,Mapbox GL JS 的一些文档似乎会有所帮助。https://www.mapbox.com/blog/azure-maps-adds-data-driven-styling-powered-by-mapbox-gl

在这种情况下,我们使用了 setLayoutProperty ( https://docs.mapbox.com/mapbox-gl-js/api/map/#map#setlayoutpropertyhttps://docs.mapbox.com/mapbox-gl-js /example/language-switch/ ) 方法来改变它。但是,我们不确定属性名称将来是否会更改,Azure Indoor Maps 处于预览状态,这种更改可能存在风险。

这是我们在项目中用于显示 nameAlt 属性的代码片段。

map.events.add('render', function (e) {
            //Used the render function to get all the layers, including the layers for indoor maps.
            //Set the nameAlt in the text-field instead of name in indoor_global_unit_label
            map.map.setLayoutProperty('microsoft.maps.indoor.labels_indoor.indoor_global_unit_label', 'text-field', '{nameAlt}');
        });

推荐阅读