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

Error when retriving the lat and lng in GoogleMaps #642

Closed
hugomosh opened this issue Oct 5, 2016 · 3 comments
Closed

Error when retriving the lat and lng in GoogleMaps #642

hugomosh opened this issue Oct 5, 2016 · 3 comments

Comments

@hugomosh
Copy link

hugomosh commented Oct 5, 2016

In the build I get this error when trying to get the camera position:

Property 'lat' does not exist on type 'GoogleMapsLatLng | GoogleMapsLatLngBounds'.

In the ts of ionic-native there is this class but it doesnt share the object Instance.

/**
 * @private
 */
export class GoogleMapsLatLng {
  private _objectInstance: any;

  constructor(public lat: number, public lng: number) {
    this._objectInstance = new plugin.google.maps.LatLng(lat, lng);
  }

  equals(other: GoogleMapsLatLng): boolean {
    return this.lat === other.lat && this.lng === other.lng;
  }

  @CordovaInstance({ sync: true })
  toString(): string { return; }

  toUrlValue(precision?: number): string {
    precision = precision || 6;

    return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision);
  }
}

How can I retrive the lat or the original object? toString works fine.

Or how can I skipped the ionic-native and use the regular plugin??

@ihadeed ihadeed closed this as completed in 72a694a Oct 6, 2016
@ihadeed ihadeed reopened this Oct 6, 2016
@ihadeed
Copy link
Collaborator

ihadeed commented Oct 6, 2016

Just pushed a commit that should fix this issue. Please stay tuned for the next release and let us know if the issue is resolved.

@ihadeed
Copy link
Collaborator

ihadeed commented Oct 6, 2016

Please update to ionic-native@2.1.2 and let me know if you're still having this issue.

@ihadeed ihadeed closed this as completed Oct 6, 2016
@fmendoza
Copy link

fmendoza commented Nov 6, 2016

I'm having this issue on ionic-native@2.2.3

this.map.getCameraPosition().then(camera => {
      this.params.location = {
        latitude: camera.target.lat,
        longitude: camera.target.lng
      };
});

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