Get center of map with ionic native google maps

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

It’s working now :neutral_face:

What did you do to get it working?

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

1 Like

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