Skip to content

Instantly share code, notes, and snippets.

@peterdesmet
Last active January 2, 2016 19:28
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 peterdesmet/8350285 to your computer and use it in GitHub Desktop.
Save peterdesmet/8350285 to your computer and use it in GitHub Desktop.
LatLong Crosshairs for Google Maps by Pierre Bélisle and Peter Desmet for Canadensys. http://www.canadensys.net/latlong-crosshairs
javascript:var coord;var output;var xhs;if(!document.getElementById('xhs')){xhs=document.createElement('div');xhs.setAttribute('id','xhs');xhs.setAttribute('style', 'background:url(\'http://www.canadensys.net/crosshair.png\') top left no-repeat;position:absolute;top:50%;left:50%;margin-top:-7px;margin-left:-7px;height:15px;width:15px;');xhs.onclick=function(){coord = [gApplication.getMap().getCenter().lat(),gApplication.getMap().getCenter().lng()];output = Math.round(coord[0]*10000000)/10000000 + '\t' + Math.round(coord[1]*10000000)/10000000;prompt('Latitude and Longitude',output);};void(document.getElementById('map').appendChild(xhs));}else{void(document.getElementById('map').removeChild(xhs));}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment