arnaudleclerc / ng-azure-maps

Angular wrapper around azure maps
MIT License
16 stars 14 forks source link

Map controls and SearchService response object #54

Open Brighty35 opened 2 years ago

Brighty35 commented 2 years ago

Following an Azure Maps tutorial online found here:https://www.youtube.com/watch?v=wpTAU9_H7ro

I have had several issues which have meant I am unable to progress:

  1. When trying the set the map controls position ``` <azure-map [center]="[-0.182679, 52.336618]" [zoom]="11" [showLogo]="false" (onClick)="mapClick($event.event)" (onReady)="mapReady($event)">

    I am getting this error ```
    declare (property) ControlDirective.position: atlas.ControlPosition
    Type '"top-right"' is not assignable to type 'ControlPosition'.ngtsc(2322)
    [app.component.ts(3, 59): ]()Error occurs in the template of component AppComponent.
  2. Trying to use the Search Service: ``` constructor(private readonly searchService: SearchService) {} mapClick(event:atlas.MapMouseEvent) { console.log(event.position) } mapReady (event: IMapEvent) { this.searchService.searchAddress("ramsey", { countrySet: ['uk', 'us']}) .subscribe(response => { const features = []; for(const result of response.results) { event.map.markers.add( new atlas.HtmlMarker({ position: [result.position.lon, result.position.lat] }) ) features.push(new atlas.data.Point([result.position.lon, result.position.lat])) } event.map.setCamera({ bounds:atlas.data.BoundingBox.fromData(features) }) }) } }

    Getting this error please advise:

    (parameter) response: atlas.service.Models.SearchAddressResponse Object is possibly 'undefined'.ts(2532)

TynaDaoEmerson commented 2 years ago

I am having the same issue with azure maps controls (issue 1). 'position' for the controls is not working with latest ng-azure-maps version. They way I resolved is by downgrading all the packages to the following:

"azure-maps-control": "^2.1.10", "azure-maps-drawing-tools": "^0.1.10", "azure-maps-rest": "^2.0.8", "ng-azure-maps": "^3.6.0"

Then the position is able to be assigned. My project is on Angular 13. Hopefully this can get resolved as the way I resolved the problem is not ideal and I would like to have the latest ng-azure-maps installed and working.

arnaudleclerc commented 2 years ago

Sorry I didn't response earlier, I don't currently have a lot of time to work on this library. I'll try to take a look at this today.

arnaudleclerc commented 2 years ago

I took a quick look at the different controls and the position attribute, and so far it looks fine to me. I have tested it with the latest version and targeting the latest version of azure-maps-control.

Displaying control and positioning them like them did not raise any error :

<azure-map>
  <map-zoom-control position='top-left'></map-zoom-control>
  <map-pitch-control position="top-right"></map-pitch-control>
  <map-compass-control position="bottom-left"></map-compass-control>
  <map-style-control position="bottom-right"></map-style-control>
</azure-map>

Could you please give me more information or send me a repo where I could reproduce the issue ?