Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const googleMapsLookup = (address, apiKey) =>
- fetch(`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURI(address)}&key=${apiKey}`)
- .then(res => res.json())
- .then(data => {
- const { lat, lng } = data.results[0].geometry.location
- return { lat, lon: lng }
- })
- .catch(() => ({ lat: 0, lon: 0 }))
Add Comment
Please, Sign In to add comment