title: why google map is not pointing to my current location in ionic cordova
body: <p>Why i'm unable to point <code>marker</code> on my <code>current</code> <code>location</code>.  the <code>marker</code> is pointing to somewhere else.</p>
  
  <p><strong>here is a screenshot:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/NSUnI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NSUnI.png" alt="enter image description here"></a></p>
  
  <p><strong>below is my complete code:</strong></p>
  
  <pre><code>import { Component } from '@angular/core';
  import { IonicPage, NavController, NavParams } from 'ionic-angular';
  import { Geolocation ,GeolocationOptions } from '@ionic-native/geolocation';
  
  
  import {
   GoogleMaps,
   GoogleMap,
   GoogleMapsEvent,
   LatLng,
   CameraPosition,
   MarkerOptions,
   Marker
  } from '@ionic-native/google-maps';        
  
  @IonicPage()
  @Component({
    selector: 'page-google-map-test',
    templateUrl: 'google-map-test.html',
  })
  
  export class GoogleMapTestPage {
  
  
    constructor(...,public googleMaps: GoogleMaps,private geolocation : Geolocation) {
    }
  
   ionViewDidLoad() {
  
      this.mapHandler2();       
    }
  
    mapHandler2(){
  
  
                // create a new map by passing HTMLElement
       let element: HTMLElement = document.getElementById('map');
  
       let map: GoogleMap = this.googleMaps.create(element);
  
       let LatLang: LatLng = new LatLng(43.0741904,-89.3809802); 
  
  
            // create CameraPosition 
         let position: any = {
            target: LatLang,    
            zoom: 18,
            tilt: 30
         };     
  
  
          map.one(GoogleMapsEvent.MAP_READY).then(() =&gt; {
           console.log('Map is ready!');
           // Now you can add elements to the map like the marker
          //   map.moveCamera(position);
  
           // create new marker
          let markerOptions:any = {
              position: LatLang,
              title: 'Ionic'
          };
  
          const marker:any = map.addMarker(markerOptions)
              .then((marker: Marker) =&gt; {
                  marker.showInfoWindow();
              });
  
  
           this.geolocation.getCurrentPosition().then((position) =&gt; {
  
               let LatLang: LatLng = new LatLng(position.coords.latitude,position.coords.longitude);
  
  
                 map.setCameraTarget(LatLang);
                 map.setCameraZoom(18);
  
                  let defPosition: any = {
                      target: LatLang,    
                      zoom: 18,
                      tilt: 30
                   };
  
  
                  map.moveCamera(defPosition);
  
  
                  let markerOptions:any = {
                      position: LatLang,
                      title: 'Your Current Location'
                  };
  
                  const marker:any = map.addMarker(markerOptions)
                      .then((marker: Marker) =&gt; {
                          marker.showInfoWindow();
                    });     
  
  
            }, (err) =&gt; {
              console.log(err); 
              alert('location error');            
            });
  
          });
  
    }
  
  }
  </code></pre>
  
  <blockquote>
    <p><strong>Thinking that i'm not getting co-ordinates i changed my code like below code, which is not showing even google map</strong></p>
  </blockquote>
  
  <p><strong>below is code:(Not Showing Anything)</strong></p>
  
  <pre><code>import { Component } from '@angular/core';
  import { IonicPage, NavController, NavParams } from 'ionic-angular';
  import { Geolocation ,GeolocationOptions } from '@ionic-native/geolocation';
  
  
  import {
   GoogleMaps,
   GoogleMap,
   GoogleMapsEvent,
   LatLng,
   CameraPosition,
   MarkerOptions,
   Marker
  } from '@ionic-native/google-maps';      
  
  
  @IonicPage()
  @Component({
    selector: 'page-google-map-test',
    templateUrl: 'google-map-test.html',
  })
  
  export class GoogleMapTestPage {
  
  
    constructor(...,public googleMaps: GoogleMaps,private geolocation : Geolocation) {
    }
  
   ionViewDidLoad() {
  
       this.getCurrentLocation();           
    }
  
    getCurrentLocation(){
  
               this.geolocation.getCurrentPosition().then((position) =&gt; {
  
               let LatLang: LatLng = new LatLng(position.coords.latitude,position.coords.longitude);
  
               this.mapHandler2(LatLang);
  
            }, (err) =&gt; {
              console.log(err); 
              alert('location error');            
            });
    }
  
  
    mapHandler2(LatLang){          
  
  
                // create a new map by passing HTMLElement
       let element: HTMLElement = document.getElementById('map');
  
       let map: GoogleMap = this.googleMaps.create(element);
  
  
          map.one(GoogleMapsEvent.MAP_READY).then(() =&gt; {
           console.log('Map is ready!');
  
                 let defPosition: any = {
                      target: LatLang,    
                      zoom: 18,
                      tilt: 30
                   };
  
  
                  map.moveCamera(defPosition);
  
  
                  let markerOptions:any = {
                      position: LatLang,
                      title: 'Your Current Location'
                  };
  
                  const marker:any = map.addMarker(markerOptions)
                      .then((marker: Marker) =&gt; {
                          marker.showInfoWindow();
                    }); 
  
  
  
  
          });
  
    }
  
  }
  </code></pre>