Skip to main content

Get Latitude and Longitude

This functions allows to get the latitude and longitude of a geocoder result.

Firm

const getLatLng = (result: google.maps.GeocoderResult): Promise<any>;

Usage

import { geocodeByAddress, getLatLng } from 'react-google-places-autocomplete';

geocodeByAddress('Montevideo, Uruguay')
.then(results => getLatLng(results[0]))
.then(({ lat, lng }) =>
console.log('Successfully got latitude and longitude', { lat, lng })
);