Skip to content

Instantly share code, notes, and snippets.

private geocodeLocation(location: string): Observable<any> {
if (!this.geoCoder) this.geoCoder = new (<any>window).google.maps.Geocoder();
return new Observable((observer) => {
this.geoCoder.geocode({address: location}, (result, status) => {
if (status === 'OK') {
const geometry = result[0].geometry.location;
const coordinates = {lat: geometry.lat(), lng: geometry.lng()};