Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map controls and SearchService response object #54

Open
Brighty35 opened this issue Mar 20, 2022 · 3 comments
Open

Map controls and SearchService response object #54

Brighty35 opened this issue Mar 20, 2022 · 3 comments

Comments

@Brighty35
Copy link

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. ```
  1. 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)

@Brighty35 Brighty35 changed the title Map controls on SearchService Map controls and SearchService response object Mar 20, 2022
@TynaDaoEmerson
Copy link

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
Copy link
Owner

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
Copy link
Owner

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants