Closed SoriaDamian17 closed 11 months ago
Hi there!
Thank you for bringing this issue to our attention. I've successfully resolved it by utilizing setLocationType("ROOFTOP")
. Here's an example of how you can use it in your code:
import {
setKey,
geocode,
setLocationType,
RequestType,
fromLatLng,
} from 'react-geocode';
setKey('YOUR_API_KEY'); // Replace with your API key
setLocationType('ROOFTOP');
geocode(RequestType.LATLNG, '48.8583701,2.2922926')
.then(({results}) => {
const address = results[0].formatted_address;
console.log(address);
})
.catch(console.error);
// OR
fromLatLng(48.8583701, 2.2922926)
.then(({results}) => {
const {lat, lng} = results[0].geometry.location;
console.log(lat, lng);
})
.catch(console.error);
Feel free to reach out if you have any further questions or concerns. Thanks again for your contribution!
I cannot use Geocode.setLocationType("ROOFTOP");