首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >harp.gl与角ng

harp.gl与角ng
EN

Stack Overflow用户
提问于 2020-06-19 18:41:18
回答 2查看 226关注 0票数 1

我们在ng角应用程序中使用harp.gl,但在连接数据源时遇到了困难,其方式与我们在纱线演示中使用的方式相同。 我们将数据源创建为:

代码语言:javascript
复制
const dataSource = new OmvDataSource({
  baseUrl: "https://vector.hereapi.com/v2/vectortiles/base/mc",
  apiFormat: APIFormat.XYZOMV,
  styleSetName: "tilezen",
  authenticationCode: apikey,
  authenticationMethod: {
        method: AuthenticationMethod.QueryString,
        name: "apikey"
  }
});

并创建MapView,如下所示:

代码语言:javascript
复制
const mapView = new MapView({
    canvas: mapCanvas,
    theme: "assets/resources/berlin_tilezen_base.json",
    // note, this URL may vary depending on configuration of webpack
    // for this example, it is assumed that app is server from project root
    decoderUrl: "harp-gl-decoders.bundle.js"
    // note, this URL may vary depending on configuration of webpack
    // for this example, it is assumed that webpack emits bundles to project root
});

并因此添加数据源:

代码语言:javascript
复制
mapView.addDataSource(dataSource);

在控制台看到这个:

代码语言:javascript
复制
[WDS] App updated. Reloading...  
Angular is running in the development mode. Call enableProdMode() to enable the production mode.  
MapView: Failed to connect to datasource anonymous-datasource#1: Error during worker initialization  
[WDS] Live Reloading enabled.  

它位于网页的调试控制台上:

代码语言:javascript
复制
:4200/decoder.bundle.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)  
ConsoleChannel.js:15 MapView: Failed to connect to datasource anonymous-datasource#1: Error during worker initialization  

我花了很多时间抓吸管,愿意接受任何帮助。

EN

回答 2

Stack Overflow用户

发布于 2020-06-25 19:55:54

作为在这里看到的,您可能需要在页面头中增加一个元标记。

代码语言:javascript
复制
<head>
    <meta http-equiv="Content-Security-Policy" content="child-src blob:">
</head>
票数 0
EN

Stack Overflow用户

发布于 2020-08-18 20:37:09

最近添加了一个关于角的入门指南:https://github.com/heremaps/harp.gl/blob/master/docs/GettingStartedAngular.md

几乎在最后,它将decoder.bundle.js添加到angular.json的资产部分:

代码语言:javascript
复制
        "assets": [
          "src/favicon.ico",
          "src/assets",
          {
            "glob": "decoder.bundle.js",
            "input": "./",
            "output": "./"
          }
        ],
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62476658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档