Skip to content

Instantly share code, notes, and snippets.

@here-devblog-gists
Created January 14, 2016 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save here-devblog-gists/a0e5ab0ceb9c691da4b0 to your computer and use it in GitHub Desktop.
Save here-devblog-gists/a0e5ab0ceb9c691da4b0 to your computer and use it in GitHub Desktop.
function setUpClickListener(map) {
map.addEventListener('tap', function (evt) {
var coord = map.screenToGeo(evt.currentPointer.viewportX,
evt.currentPointer.viewportY);
alert('Clicked at ' + Math.abs(coord.lat.toFixed(4)) +
((coord.lat > 0) ? 'N' : 'S') +
' ' + Math.abs(coord.lng.toFixed(4)) +
((coord.lng > 0) ? 'E' : 'W'));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment