When I click on the map, I attempted to retrieve the location address from latitude and longitude. So far, I have successfully obtained the latitude and longitude coordinates upon clicking.
I then tried to use the function below to get the address:
getCurrentLocation(lat,lng): Observable<any> {
return this._http.get("http://maps.googleapis.com/maps/api/geocode/json?latlng="+lat+","+lng+"&sensor=true")
.map(response => response.json())
.catch(error => {
console.log(error);
return Observable.throw(error.json());
});
}
For my typescript
function, I imported the following dependencies:
import { } from 'googlemaps';
import { Observable } from 'rxjs/Observable';
import {Http} from '@angular/http';
Despite these efforts, I am still struggling to retrieve the address. Any suggestions or ideas?