Googlemap click event

Hi… Just wondering how to get the location of the point when the user clicks on the map.

I used the control and have the code on the click event but no luck. Gived an undefined message.
Any help would be much appreciated.

Nick

sub googlemap1_onclick(event)
  console.log (event.LatLng)
end sub

You’ll need to look at Google’s docs to see what is returned in event.

You could also change the code to be:

sub googlemap1_onclick(event)
  console.log (event)
end sub

Then, in the Console. click on the arrow beside the output and see the fields in event.

I don’t know what the basic version is because I’ve not written basic since GWBasic back in the 80’s. LOL

I think what you’re looking for is:

console.log(googlemap1_onclick.latLng)

In Javascript, I drop a pin and then grab the position like this:

    console.log("lat: " +this.internalPosition.lat());
    console.log("lng: " +this.internalPosition.lng());

This allows me to enable pin dragging and to get the new coordinates once the user has finished.