我们在 ng angular 应用程序中使用 harp.gl,但是在连接到数据源时遇到了问题,这与我们在 yarn 演示中的工作方式相同。
我们将数据源创建为:
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 为:
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
});
并添加数据源:
mapView.addDataSource(dataSource);
并在控制台上看到这个:
[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.
这在网页的调试控制台上:
: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
我花了很多时间抓住稻草,愿意接受任何帮助。