Hello @myaskevich ,
With the current implementation, it seems like you can only do reverse geocoding with the current location, but is there a way to do reverse geocoding with a given place_id or longitude and latitude?
Thank you!
Hi @yangster24
I don't quite see how this library can help you do reverse geocoding by latlng/place_id.
Why not simply make a HTTP request via Google Maps REST API like so:
let params = {
key: 'YOUR_API_KEY',
latlng: `${latitude},${longitude}`,
};
let qs = querystring.stringify(params);
return fetch(
`https://maps.googleapis.com/maps/api/geocode/json?${qs}`)
.then((res) => res.json())
.then((json) => {
if (json.status !== 'OK') {
throw new Error(`Geocode error: ${json.status}`);
}
return json;
});
}
@myaskevich Thank you so much! This provides a lot versatility to use various parts of Google Maps API :)
Most helpful comment
Hi @yangster24
I don't quite see how this library can help you do reverse geocoding by latlng/place_id.
Why not simply make a HTTP request via Google Maps REST API like so: