Get center of map with ionic native google maps

#1

Hi all,

I’m trying to get the center of the map in order to place a google marker. However, I can’t find a way with the ionic native wrapper.

Here’s what I have. .

this.map.getCameraPosition().then((latLngBounds) => {
   console.log(latLngBounds.target);
});

Error

Cannot invoke an expression whose type lacks a call signature. Type LatLng | LatLngBounds | LatLng[]’ has no compatible call signature.

Thanks

#2

It’s working now :neutral_face:

#3

What did you do to get it working?

#4

nothing :slight_smile: The code works fine something else must have been affecting it.?

1 Like
#5

I was looking for the answer for this question and it seems this won’t work (Anymore).

this.map.getCameraPosition() doesn’t return a promise.

You should use:

let center = this.map.getCameraPosition().target;
1 Like