首页 > 解决方案 > 当用户使用js或ts点击地图时,我们如何转换azure地图语言?

问题描述

我正在为 Angular 6 中的 azure 地图声明一个点击事件,所以如果在迪拜位置点击地图,我会得到阿拉伯文本,我想将其转换为英语。

这是我的代码:


 mapClicked(e) {
    console.log(e);
    OrderOnlineComponent.searchURL.searchAddressReverse(atlas.service.Aborter.timeout(30000), e.position).then(results => {
      let data = results.geojson.getFeatures();
      console.log(data);
      let content = '<div style="padding:10px">';
      if (data.features.length > 0 && data.features[0].properties && data.features[0].properties.address && data.features[0].properties.address.freeformAddress) {
        content += data.features[0].properties.address.freeformAddress;
      } else {
        content += 'No address for that location!';
      }
      content += '</div>';
      //Set the popup options.
      // console.log("content to display...:", data.features[0].properties.address.freeformAddress.split(','));
      // this.setVal(data.features[0].properties.address.freeformAddress.split(','));
      OrderOnlineComponent.popup.setOptions({
        position: e.position,
        content: content
      });

      OrderOnlineComponent.addressObserve.next(data.features[0].properties.address.freeformAddress.split(','));
      //Open the popup.
      OrderOnlineComponent.popup.open(OrderOnlineComponent.etAddMap);
      // return (data.features[0].properties.address.freeformAddress);
    });
  }

这有什么帮助吗?

标签: javascriptangular

解决方案


推荐阅读