我试图在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地图上有一条折线。