How can I get x and y number at every click event

2020-07-13 08:52发布

问题:

I want to retrieve x/y coordinates at every click-event on Google Maps.

Could someone help me please?

回答1:

google.maps.event.addListener(map, "click", function (e) {
        document.form1.waypointLog.value = e.latLng.lat().toFixed(6)
        + ' |' + e.latLng.lng().toFixed(6);

}); 

Source: https://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/3f4329e3a20e7b0b

You can also check: http://forums.gpsreview.net/viewtopic.php?t=3632