Get lat and long with pointer
ChuchoJuarez opened this issue · comments
ChuchoJuarez commented
Hi I want to know if it is possible to get the coordinates with the pointer.
regards
Michele Bertoli commented
Hello @ChuchoJuarez, can you please explain what you are trying to do in more details?
I'm not sure what you mean by "with pointer".
Thanks!
William Han commented
Hey @ChuchoJuarez,
I'm assuming you want to get the coordinates of the user clicks. Below is a sample code snippet that would allow you to get the latitude and longitude of the user's click:
class Map extends Component{
onClick(e){
var latLong = [e.latLng.lat(), e.latLng.lng()];
console.log(latLong);
}
render(){
return(
<GMaps
//insert params here
onClick = {this.onClick}
</GMaps>
);
}
}
ChuchoJuarez commented
Thanks!!!!! @copperstick6 this is just what I needed