question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GoogleMapsAPIWrapper getBounds not returning

See original GitHub issue

Hello, I am trying to get the maps bounds thourgh the GoogleMapsAPIWrapper service. I am using the Promise<LatLngBounds> function getBounds().

Nothing is returned.

Here’s my code.

constructor(private searchService: SearchService, 
    private wrapper: GoogleMapsAPIWrapper, 
    private _loader: MapsAPILoader, 
    private zone: NgZone) {
  }

  ngOnInit() {
   this.wrapper.getBounds().then(x => console.log(x));  
  }

the console.log function is not called as the peomise never returns anything.

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:21 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
craftpipcommented, Jun 1, 2017

@SebastianM Im using Angular4, I can confirm GoogleMapsAPIWrapper’s promises don’t work.

3reactions
josueadelimacommented, May 29, 2017

Using sebm-google-map component inside a template you can use:

<sebm-google-map (boundsChange)="boundsChange($event)"></sebm-google-map>

and then inside your component:

boundsChange(event) {
    console.log(event.getNorthEast().lat());
    console.log(event.getNorthEast().lng());
    console.log(event.getSouthWest().lat());
    console.log(event.getSouthWest().lng());
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

GoogleMapsAPIWrapper getBounds not returning #696
Hello, I am trying to get the maps bounds thourgh the GoogleMapsAPIWrapper service. I am using the Promise function getBounds(). Nothing is returned....
Read more >
Google Maps Api v3 - getBounds is undefined
Map.getBounds() may return undefined initially. The preferred workaround to this is to use the bounds_changed event. Typically, an undefined ...
Read more >
GoogleMapsAPIWrapper
Returns the native Google Maps Map instance. Be careful when using this instance directly. Returns : Promise<google.maps.Map>. getZoom.
Read more >
map.getBounds() don't work
them, getBounds() may not be able to be called so soon after initializing the map. ... is returned (possibly because no map has...
Read more >
agm/core
google-maps-api-wrapper ';\nimport * as mapTypes from '. ... n */\n getBounds(): Promise<LatLngBounds> { return this._manager.getBounds(this); }\n\n ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found