无法在Angular 7 Bingmap(x-map)中绘制折线

问题描述 投票:0回答:1

我试图在Angular 7中的bingmap上绘制一条多段线,但是我能够加载地图并能够创建标记,但未创建多段线。我已经搜索了google,但未找到解决方案。

没有得到我缺少的东西。我尝试添加到地图。

我已经添加了app.component页面

/// <reference path="../../node_modules/bingmaps/types/MicrosoftMaps/Microsoft.Maps.All.d.ts" />
----other module
import {
  MapModule,
  BingMapAPILoaderConfig, BingMapAPILoader, MapPolylineDirective
} from 'angular-maps';

----other module

@NgModule({
  declarations: [MapBingComponent],
  imports: [MapModule.forRootBing()],
entryComponents: [],
  exports: [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
export function BingMapServiceProviderFactory() {
  let bc: BingMapAPILoaderConfig = new BingMapAPILoaderConfig();
  bc.apiKey = "my-key";
  // replace with your bing map key
  // the usage of this key outside this plunker is illegal. 
  bc.branch = "experimental";
  // to use the experimental bing brach. There are some bug fixes for
  // clustering in that branch you will need if you want to use 
  // clustering.
  return new BingMapAPILoader(bc, new WindowRef(), new DocumentRef());
}
<x-map #xmap [Options]="_options" [Box]="_box">
<x-map-polyline [Paths]="path" [StrokeColor]="blue" [StrokeWeight]="10"></x-map-polyline>
</x-map>

import { Component, OnInit } from '@angular/core';
import { Configuration } from '../app.constants';
import {
    IMapOptions, ILatLong
} from 'angular-maps';

/// <reference path="bingmaps/types/MicrosoftMaps/Microsoft.Maps.All.d.ts" />

let PathData: Array<any> = null;

@Component({
    selector: 'virtuoso-map-bing',
  templateUrl: './map-bing.component.html',
  styleUrls: ['./map-bing.component.scss']
})

export class MapBingComponent implements OnInit {
  path: Array<ILatLong> | Array<Array<ILatLong>>;
  constructor() {
    this.path = [{ latitude: -27.153, longitude: 152.9778 },
      { latitude: -27.409, longitude: 153.0763 }
    ];
  }

  ngOnInit() {
  }

  _options: IMapOptions = {
    disableBirdseye: false,
    disableStreetside: false,
    navigationBarMode: 2,
    showMapTypeSelector: true,
    showCopyright: false,
    disableZooming: false,
    showDashboard: true,
  };


}

我希望在Bing地图上有一条折线。

typescript angular7 bing-maps polyline
1个回答
0
投票

你得到决议了吗?

我也在尝试相同的方法。

© www.soinside.com 2019 - 2024. All rights reserved.