Answers for "react-geocode lat lng to address"

0

react-geocode lat lng to address

// npm install react-geocode
// Don't forget to enter your Google API key in line 9 or this will not work

import Geocode from "react-geocode";

Geocode.setApiKey("<INSERT YOUR API KEY HERE>"); // Enter Google Maps API here
Geocode.enableDebug();

Geocode.fromLatLng("44.5", "-89.5").then(
  response => {
    const address = response.results[0].formatted_address;
    console.log(address);
  },
  error => {
    console.error(error);
  }
);
Posted by: Guest on February-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language