angular2-baidu-map
angular2-baidu-map copied to clipboard
When using negative longitude marker doesn't show.
i have an issue with markers.
I have code:
<baidu-map [options]="opts" (loaded)="mapLoaded($event)"> <ng-container> <marker-clusterer [options]="clustererOptions" (loaded)="clustererLoaded($event)" > </marker-clusterer> </ng-container> </baidu-map>
and markers is
{ "markers": [ { "point": { "lat": 51.5083458, "lng": "-0.1" } }, { "point": { "lat": 52.246124, "lng": 0.3 } }, { "point": { "lat": 51.244604, "lng": 0 } } ] }
and result is
We see points 52.246124, 0.3 and 51.244604, 0. but point with coordinates 51.5083458, -0.1 doesn't show. In dom this point exists but property left: 78629.4px
Any ideas how can I fix this
@s-komzarev I believe that is a bug with BaiduMap SDK JavaScript API v3.0 which i used for angular2-baidu-map.
I tried to switch back to BaiduMap SDK JavaScript API v2.0, the marker can be displayed well.
I am thinking if there is any risk of changing back to API 2.0, or maybe you will help to verify it?
- Change
3.0to2.0in following code:
https://github.com/leftstick/angular2-baidu-map/blob/master/projects/lib/src/lib/providers/mapService.ts#L38
- rebuild the lib with
yarn build
It works thanks. I have a new task that I'm having trouble with. I need to display the marker information using a component. It should be something like this.
`
exampleComponent {
@ViewChild('cardTemplate', { static: false }) templateContent: TemplateRef
showWindow(marker): void {
this.map.openInfoWindow(
new window.BMap.InfoWindow(this.templateContent, {
offset: new window.BMap.Size(0, -30),
title: 'Title'
}),
marker.getPosition()
);
} } `
and html
<baidu-map [options]="opts" (loaded)="mapLoaded($event)"> <marker-clusterer [options]="clustererOptions" (loaded)="clustererLoaded($event)"> </marker-clusterer> </baidu-map> <ng-template #cardTemplate> <app-center-card></app-center-card> </ng-template>
Perhaps you can help me with this?