Created
March 2, 2014 15:04
-
-
Save cuter44/9307843 to your computer and use it in GitHub Desktop.
附着在百度经纬度拾取工具的增强, 将经纬度转换成 geohash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** user-script baidu map Lat/Long -> geohash.org adapter | |
| * attach to http://api.map.baidu.com/lbsapi/getpoint/index.html | |
| * for non-IE | |
| */ | |
| function toGeohash() | |
| { | |
| var loc = document.getElementById("pointInput").value.split(","); | |
| var body = document.getElementsByTagName("body")[0]; | |
| var oldf = document.getElementById("geohash"); | |
| oldf.src = "http://geohash.org/?q="+loc[1]+","+loc[0]+"&format=url&redirect=0"; | |
| } | |
| function attach() | |
| { | |
| document.getElementById("MapHolder").addEventListener("click", toGeohash, false); | |
| var f = document.createElement("iframe"); | |
| f.id = "geohash"; | |
| pos = document.getElementById("pointInput"); | |
| pos.parentNode.insertBefore(f, pos); | |
| f.height = 32; | |
| } | |
| if (location.href.match("http://api.map.baidu.com/lbsapi/getpoint/index.html").length == 1) | |
| { | |
| setTimeout("attach()", 10000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment