//=0?"+":"-") + Math.abs(geoloc.int_latd) + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 3); urlstr += "&lon=" + (geoloc.int_lond>=0?"+":"-") + Math.abs(geoloc.int_lond) + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 3); return(urlstr); }; break; case "mapfan": //OK Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; //http://kokomail.mapfan.com/receivew.cgi?MAP=E135.43.13.6N34.32.3.2&ZM=11&CI=R geoloc = WGS84toTOKYO(geoloc); geoloc = locVariation(geoloc); urlstr += "kokomail.mapfan.com/receivew.cgi?MAP="; urlstr += (geoloc.int_lond >=0 ?"E":"W") + geoloc.int_lond + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 1); urlstr += ((geoloc.int_lond >=0 ?"N":"S")) + geoloc.int_latd + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 1); urlstr += "&ZM=11&CI=R"; return(urlstr); }; break; case "yahoomapjapan": //OK Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; //http://map.yahoo.co.jp/pl?nl=34.32.4.798&el=135.43.12.453&CE.x=282&CE.y=300&sc=2&la=1 geoloc = WGS84toTOKYO(geoloc); geoloc = locVariation(geoloc); urlstr += "map.yahoo.co.jp/pl?"; urlstr += "nl=" + geoloc.int_latd + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 3); urlstr += "&el=" + geoloc.int_lond + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 3); urlstr += "&CE.x=282&CE.y=300&sc=2"; return(urlstr); }; break; case "itsmoguide": //OK Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; //http://www.its-mo.com/z.htm?m=E135.29.55.355N34.41.57.286&l=10 //http://mobile.its-mo.com/MapToLink/p1?c=6&sid=00320&n=34.534269444444&e=135.72043611111&x=5 <--- From Mobile ONLY geoloc = WGS84toTOKYO(geoloc); geoloc = locVariation(geoloc); urlstr += "www.its-mo.com/z.htm?m="; urlstr += (geoloc.int_lond >=0 ?"E":"W") + geoloc.int_lond + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 3); urlstr += (geoloc.int_lond >=0 ?"N":"S") + geoloc.int_latd + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 3); urlstr += "&ZM=11&CI=R"; return(urlstr); }; break; case "goomap": //OK Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; //http://map.goo.ne.jp/map.php?MAP=E135.43.23.560N34.31.55.780&ZM=&SZ=&sw=1&C1=29&C2=210&POSTAL= geoloc = WGS84toTOKYO(geoloc); geoloc = locVariation(geoloc); urlstr += "map.goo.ne.jp/map.php?MAP="; urlstr += (geoloc.int_lond >=0 ?"E":"W") + geoloc.int_lond + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 3); urlstr += (geoloc.int_lond >=0 ?"N":"S") + geoloc.int_latd + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 3); urlstr += "&ZM=11&CI=R"; return(urlstr); }; break; case "livedoormap": //OK Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; //http://map.livedoor.com/map/?SZ=500,320&ZM=10&MAP=E135.43.13.7N34.32.3.1 geoloc = WGS84toTOKYO(geoloc); geoloc = locVariation(geoloc); urlstr += "map.livedoor.com/map/?SZ=500,320&ZM=10&MAP="; urlstr += (geoloc.int_lond >=0 ?"E":"W") + geoloc.int_lond + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 1); urlstr += (geoloc.int_lond >=0 ?"N":"S") + geoloc.int_latd + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 1); urlstr += "&ZM=11&CI=R"; return(urlstr); }; break; case "chizumaru": //OK Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; //http://www.chizumaru.com/maplink.asp?SER=all&D=all&X=…&Y=…&SCL=… geoloc = WGS84toTOKYO(geoloc); geoloc = locVariation(geoloc); urlstr += "www.chizumaru.com/maplink.asp?SER=all&D=all"; urlstr += "&" + (geoloc.int_lond >=0 ?"E":"W") + "=" + geoloc.int_lond + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 3); urlstr += "&" + (geoloc.int_lond >=0 ?"N":"S") + "=" + geoloc.int_latd + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 3); urlstr += "&SCL=500"; return(urlstr); }; break; case "msnmapjapan": //OK ???looks like lat and lon is opposite ?? Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; //http://map.msn.co.jp/mapmarking.armx?mode=1&la=139.44.55.9&lg=35.39.19.2&zm=10&smode=1 geoloc = WGS84toTOKYO(geoloc); geoloc = locVariation(geoloc); urlstr += "map.msn.co.jp/mapmarking.armx?mode=1"; urlstr += "&la=" + geoloc.int_lond + "." + geoloc.int_lonm + "." + numformat(geoloc.float_lons, 0, 1); urlstr += "&lg=" + geoloc.int_latd + "." + geoloc.int_latm + "." + numformat(geoloc.float_lats, 0, 1); urlstr += "&zm=9&smode=1"; return(urlstr); }; break; case "googlemapsjapan": //OK isGoogle = true; Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; // http://maps.google.co.jp/?q=+35.123456,+135.123456(SA2.WU4.ZZ9.ZZ9) urlstr += "maps.google.co.jp/?q=" + geoloc.latitude + "," + geoloc.longitude; return(urlstr); }; break; default: //default is googleMaps isGoogle = true; Deg2mapURLfuncs.funcs = function(geoloc){ var urlstr = "http://"; // http://maps.google.com/?q=+35.123456,+135.123456(SA2.WU4.ZZ9.ZZ9) urlstr += "maps.google.com/?q=" + geoloc.latitude + "," + geoloc.longitude + "(" + comment + ")"; return(urlstr); }; } function WGS84toTOKYO(geoloc){ var geolocTokyo = new Object(); geolocTokyo.latitude = geoloc.latitude -0 + 0.00010696 * geoloc.latitude - 0.000017467 * geoloc.longitude - 0.004602; geolocTokyo.longitude = geoloc.longitude -0 + 0.000046047 * geoloc.latitude -0 + 0.000083049 * geoloc.longitude - 0.010041; return(geolocTokyo); } function numformat(floatnum, zerofilldigit, underdecidigit){ var intpart, underdecipart, retstr; if (floatnum == ""){floatnum = "0";} //prevent error floatnum = floatnum + ""; //to string var decipos = floatnum.indexOf("."); if (decipos > 0) { var part = floatnum.split("."); intpart = part[0]; underdecipart = part[1]; }else{ intpart = floatnum; underdecipart = ""; } //left zerofill if(zerofilldigit > 0){ intpart = "" + intpart; //string if(zerofilldigit == ""){zerofilldigit = 0;}; for(var n=0; n < zerofilldigit; n++){ intpart = "0" + intpart; } intpart = intpart.substr(intpart.length - zerofilldigit, zerofilldigit); } retstr = intpart; //under decimal digit if(underdecidigit > 0){ for(var n=0; n < underdecidigit; n++){ underdecipart += "0"; } underdecipart = underdecipart.substr(0, underdecidigit); retstr += "." + underdecipart; } return(retstr); } function locVariation(geoloc){ var lat = geoloc.latitude; var latabs = Math.abs(lat); var int_latd = Math.floor(latabs); var float_latm = (latabs - int_latd) * 60; var int_latm = Math.floor(float_latm); var float_lats = (float_latm - int_latm) * 60; if(lat < 0){ int_latd = int_latd * (-1); } var lon = geoloc.longitude; var lonabs = Math.abs(lon); var int_lond = Math.floor(lonabs); var float_lonm = (lonabs - int_lond) * 60; var int_lonm = Math.floor(float_lonm); var float_lons = (float_lonm - int_lonm) * 60; if(lon < 0){ int_lond = int_lond * (-1); } geoloc.latabs = latabs; geoloc.int_latd = int_latd; geoloc.float_latm = float_latm; geoloc.int_latm = int_latm; geoloc.float_lats = float_lats; geoloc.lonabs = lonabs; geoloc.int_lond = int_lond; geoloc.float_lonm = float_lonm; geoloc.int_lonm = int_lonm; geoloc.float_lons = float_lons; return(geoloc); } //common functions function Locapoint2LatLon(locapoint){ var geoloc = new Object(); geoloc.latitude =( ((locapoint.charCodeAt(0)-65)*1757600 +(locapoint.charCodeAt(1)-65)*67600 +(locapoint.charCodeAt(2)-48)*6760 +(locapoint.charCodeAt(8)-65)*260 +(locapoint.charCodeAt(9)-65)*10 +(locapoint.charCodeAt(10)-48)) *180/45697600-90).toFixed(6); geoloc.longitude = ( ((locapoint.charCodeAt(4)-65)*1757600 +(locapoint.charCodeAt(5)-65)*67600 +(locapoint.charCodeAt(6)-48)*6760 +(locapoint.charCodeAt(12)-65)*260 +(locapoint.charCodeAt(13)-65)*10 +(locapoint.charCodeAt(14)-48) ) *360/45697600-180).toFixed(6); return(geoloc); } function LatLon2Locapoint(lat, lon){ var latstep=Math.floor(((lat-(-90))*45697600/180)); var lngstep=Math.floor(((lon-(-180))*45697600/360)); var locapoint=String.fromCharCode( Math.floor(latstep/1757600%26)+65, Math.floor(latstep/67600%26)+65, Math.floor(latstep/6760%10)+48, 46, Math.floor(lngstep/1757600%26)+65, Math.floor(lngstep/67600%26)+65, Math.floor(lngstep/6760%10)+48, 46, Math.floor(latstep/260%26)+65, Math.floor(latstep/10%26)+65, Math.floor(latstep%10)+48, 46, Math.floor(lngstep/260%26)+65, Math.floor(lngstep/10%26)+65, Math.floor(lngstep%10)+48 ); return(locapoint); } //Main Logic targeturl = Deg2mapURLfuncs.funcs(Locapoint2LatLon(locapoint)); window.open(targeturl); return(false); } //]]>