Get current position in ionic2
<p>I am new to Ionic 2 and following some tutorials.</p>

<p>In this case I need to change following method:</p>

<pre><code> applyHaversine(locations){

        let usersLocation = {


            lat: 40.713744, 
            lng: -74.009056
        };

        locations.map((location) =&gt; {

            let placeLocation = {
                lat: location.latitude,
                lng: location.longitude
            };

            location.distance = this.getDistanceBetweenPoints(
                usersLocation,
                placeLocation,
                'miles'
            ).toFixed(2);
        });

        return locations;
    }
</code></pre>

<p>You can see that variable usersLocation is hard-coded:</p>

<pre><code>let usersLocation = {


            lat: 40.713744, 
            lng: -74.009056
        };
</code></pre>

<p>I would like to get there the real user location.</p>

<p>I have seen the method Geolocation.getCurrentPosition(), but I don´t know how to implement it in this case.</p>

<p>Thank you</p>

<p>EDITED</p>

<pre><code> applyHaversine(locations){
        Geolocation.getCurrentPosition().then((resp) =&gt; {

        let  latitud = resp.coords.latitude
        let longitud = resp.coords.longitude
        }).catch((error) =&gt; {
          console.log('Error getting location', error);
        });

  console.log(this.latitud);
        let usersLocation = {

           lat:  this.latitud, 
           lng:  this.longitud 
        };
</code></pre>