Answers for "how to get latitude and longitude from address in angular 6"

0

how to get latitude and longitude from address in angular 6

getGeoLocation(address: string): Observable<any> {
    console.log('Getting address: ', address);
    let geocoder = new google.maps.Geocode();
    return Observable.create(observer => {
        geocoder.geocode({
            'address': address
        }, (results, status) => {
            if (status == google.maps.GeocoderStatus.OK) {
                observer.next(results[0].geometry.location);
                observer.complete();
            } else {
                console.log('Error: ', results, ' & Status: ', status);
                observer.error();
            }
        });
    });
}
Posted by: Guest on May-20-2021

Code answers related to "how to get latitude and longitude from address in angular 6"

Code answers related to "Javascript"

Browse Popular Code Answers by Language