Geolocation marker problem


#1

Hi guys, I am using this code for my Geolocation

onLocate() {
    const loader = this.loadingCtrl.create({
      content: 'Getting your Location...'
    });
    loader.present();
    Geolocation.getCurrentPosition()
      .then(
        location => {
          loader.dismiss();
          this.location.lat = location.coords.latitude;
          this.location.lng = location.coords.longitude;
          this.locationIsSet = true;
        }
      )
      .catch(
        error => {
          loader.dismiss();
          const toast = this.toastCtrl.create({
            message: 'Could get location, please pick it manually!',
            duration: 2500
          });
          toast.present();
        }
      );
  }

Do you maybe know the addition to this code that i should make for me to have marker placed whenever i trigger Locate me button.

Thanks!


#2

When you run this code you get the latitude and longitude of your position only, if you want to place a marker in this location you have to do with the google.maps.Marker.


#3

U need an angular plugin for this to be done easily, I found this…

https://www.npmjs.com/package/angular2-google-map