Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
I Miss GetLatLon.com
var require=function(b,j){var d=require.resolve(b,j||"/"),e=require.modules[d];if(!e)throw Error("Failed to resolve module "+b+", tried "+d);return(d=require.cache[d])?d.exports:e()};require.paths=[];require.modules={};require.cache={};require.extensions=[".js",".coffee",".json"];require._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0};
require.resolve=function(){return function(b,j){function d(a){a=g.normalize(a);if(require.modules[a])return a;for(var c=0;c<require.extensions.length;c++){var b=require.extensions[c];if(require.modules[a+b])return a+b}}function e(a){a=a.replace(/\/+$/,"");var c=g.normalize(a+"/package.json");if(require.modules[c]){var c=require.modules[c](),b=c.browserify;if("object"===typeof b&&b.main){if(c=d(g.resolve(a,b.main)))return c}else if("string"===typeof b){if(c=d(g.resolve(a,b)))return c}else if(c.main&&
(c=d(g.resolve(a,c.main))))return c}return d(a+"/index")}j||(j="/");if(require._core[b])return b;var g=require.modules.path(),c=(j=g.resolve("/",j))||"/";if(b.match(/^(?:\.\.?\/|\/)/)){var a=d(g.resolve(c,b))||e(g.resolve(c,b));if(a)return a}a:{for(var a="/"===c?[""]:g.normalize(c).split("/"),c=[],f=a.length-1;0<=f;f--)if("node_modules"!==a[f]){var h=a.slice(0,f+1).join("/")+"/node_modules";c.push(h)}for(a=0;a<c.length;a++){f=c[a];if(h=d(f+"/"+b)){c=h;break a}if(f=e(f+"/"+b)){c=f;break a}}c=(h=d(b))?
h:void 0}if(c)return c;throw Error("Cannot find module '"+b+"'");}}();require.alias=function(b,j){var d=require.modules.path(),e=null;try{e=require.resolve(b+"/package.json","/")}catch(g){e=require.resolve(b,"/")}for(var d=d.dirname(e),e=(Object.keys||function(a){var c=[],b;for(b in a)c.push(b);return c})(require.modules),c=0;c<e.length;c++){var a=e[c];a.slice(0,d.length+1)===d+"/"?(a=a.slice(d.length),require.modules[j+a]=require.modules[d+a]):a===d&&(require.modules[j]=require.modules[d])}};
(function(){var b={},j="undefined"!==typeof window?window:{},d=!1;require.define=function(e,g){!d&&require.modules.__browserify_process&&(b=require.modules.__browserify_process(),d=!0);var c=require._core[e]?"":require.modules.path().dirname(e),a=function(a){var b=require(a,c);if((a=require.cache[require.resolve(a,c)])&&null===a.parent)a.parent=f;return b};a.resolve=function(a){return require.resolve(a,c)};a.modules=require.modules;a.define=require.define;a.cache=require.cache;var f={id:e,filename:e,
exports:{},loaded:!1,parent:null};require.modules[e]=function(){require.cache[e]=f;g.call(f.exports,a,f,f.exports,c,e,b,j);f.loaded=!0;return f.exports}}})();
require.define("path",function(b,j,d,e,g,c){function a(a,c){for(var b=[],f=0;f<a.length;f++)c(a[f],f,a)&&b.push(a[f]);return b}function f(a,c){for(var b=0,f=a.length;0<=f;f--){var d=a[f];"."==d?a.splice(f,1):".."===d?(a.splice(f,1),b++):b&&(a.splice(f,1),b--)}if(c)for(;b--;b)a.unshift("..");return a}var h=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;d.resolve=function(){for(var b="",d=!1,g=arguments.length;-1<=g&&!d;g--){var e=0<=g?arguments[g]:c.cwd();"string"===typeof e&&e&&(b=e+"/"+b,d="/"===e.charAt(0))}b=
f(a(b.split("/"),function(a){return!!a}),!d).join("/");return(d?"/":"")+b||"."};d.normalize=function(c){var b="/"===c.charAt(0),d="/"===c.slice(-1);c=f(a(c.split("/"),function(a){return!!a}),!b).join("/");!c&&!b&&(c=".");c&&d&&(c+="/");return(b?"/":"")+c};d.join=function(){var c=Array.prototype.slice.call(arguments,0);return d.normalize(a(c,function(a){return a&&"string"===typeof a}).join("/"))};d.dirname=function(a){return(a=h.exec(a)[1]||"")?1===a.length?a:a.substring(0,a.length-1):"."};d.basename=
function(a,c){var b=h.exec(a)[2]||"";c&&b.substr(-1*c.length)===c&&(b=b.substr(0,b.length-c.length));return b};d.extname=function(a){return h.exec(a)[3]||""};d.relative=function(a,c){function b(a){for(var c=0;c<a.length&&""===a[c];c++);for(var f=a.length-1;0<=f&&""===a[f];f--);return c>f?[]:a.slice(c,f-c+1)}a=d.resolve(a).substr(1);c=d.resolve(c).substr(1);for(var f=b(a.split("/")),g=b(c.split("/")),e=Math.min(f.length,g.length),r=e,h=0;h<e;h++)if(f[h]!==g[h]){r=h;break}e=[];for(h=r;h<f.length;h++)e.push("..");
e=e.concat(g.slice(r));return e.join("/")}});
require.define("__browserify_process",function(b,j,d,e,g,c){c=j.exports={};c.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(a){return window.setImmediate(a)};if("undefined"!==typeof window&&window.postMessage&&window.addEventListener){var a=[];window.addEventListener("message",function(c){c.source===window&&"browserify-tick"===c.data&&(c.stopPropagation(),0<a.length&&a.shift()())},!0);return function(c){a.push(c);window.postMessage("browserify-tick","*")}}return function(a){setTimeout(a,
0)}}();c.title="browser";c.browser=!0;c.env={};c.argv=[];c.binding=function(a){if("evals"===a)return b("vm");throw Error("No such module. (Possibly not yet loaded)");};var a="/",f;c.cwd=function(){return a};c.chdir=function(c){f||(f=b("path"));a=f.resolve(c,a)}});
require.define("/Image.js",function(b,j,d){function e(a){return a.toKey()}function g(a){return a.left()}function c(a){return a.top()}function a(a){return a.width()}function f(a){return a.height()}function h(a){return a.transform()}function q(a){return a.coord.zoom}var k=b("./Mouse");b("./Base");var n=b("./Tile"),p=b("./Grid");b=function(a,c,b,f,d){this.selection=d3.select(a);this.loaded_tiles={};this.template=c;this.parent=a;k.link_control(this.selection,new k.Control(this,!0));a=k.element_size(this.parent);
f=b.locationCoordinate(f).zoomTo(d);this.grid=new p.Grid(a.x,a.y,f,3);this.projection=b;this.queue=new l(this.loaded_tiles);this.tile_queuer=this.getTileQueuer();this.tile_dequeuer=this.getTileDequeuer();this.tile_onloaded=this.getTileOnloaded();var g=this;d3.select(window).on("resize.map",function(){g.update_gridsize()});this.selection.selectAll("img.tile").remove();this.redraw(!1)};b.prototype.update_gridsize=function(){var a=k.element_size(this.parent);this.grid.resize(a.x,a.y);this.redraw(!0)};
b.prototype.pointLocation=function(a){"undefined"===typeof a&&(a=null);a=this.grid.pointCoordinate(a?a:this.grid.center);return this.projection.coordinateLocation(a)};b.prototype.locationPoint=function(a){a=this.projection.locationCoordinate(a);return this.grid.coordinatePoint(a)};b.prototype.onMoved=function(a){var c=this,b=this.moved_callback;this.moved_callback=function(){b&&b();a(c)}};b.prototype.redraw=function(b){var d=this.grid.visibleTiles(),d=this.selection.selectAll("img.tile").data(d,e);
d.exit().each(this.tile_dequeuer).remove();d.enter().append("img").attr("class","tile").attr("id",e).style("z-index",q).on("load",this.tile_onloaded).each(this.tile_queuer);n.transform_property?this.selection.selectAll("img.tile").style(n.transform_property,h):this.selection.selectAll("img.tile").style("left",g).style("top",c).style("width",a).style("height",f);b&&this.moved_callback&&this.moved_callback();this.queue.process()};b.prototype.getTileOnloaded=function(){var a=this;return function(){a.loaded_tiles[this.src]=
Date.now();a.queue.close(this);a.redraw(!1)}};b.prototype.getTileQueuer=function(){var a=this;return function(c){var b=a.template,b=b.replace("{z}","{Z}").replace("{Z}",c.coord.zoom.toFixed(0)),b=b.replace("{x}","{X}").replace("{X}",c.coord.column.toFixed(0)),b=b.replace("{y}","{Y}").replace("{Y}",c.coord.row.toFixed(0));a.queue.append(this,b)}};b.prototype.getTileDequeuer=function(){var a=this.queue;return function(){a.cancel(this)}};d.Map=b;var l;d=function(a){this.queue=[];this.queue_by_id={};
this.open_request_count=0;this.requests_by_id={};this.loaded_tiles=a};d.prototype.append=function(a,c){if(c in this.loaded_tiles)a.src=c;else{var b=new m(a,c);this.queue.push(b);this.queue_by_id[b.id]=b}};d.prototype.cancel=function(a){this.close(a);var c=this.queue_by_id[a.id];c&&(c.deny(),delete this.queue_by_id[a.id])};d.prototype.close=function(a){var c=this.requests_by_id[a.id];c&&(c.deny(),delete this.requests_by_id[a.id],this.open_request_count--)};d.prototype.process=function(){for(this.queue.sort(m.compare);8>
this.open_request_count&&0<this.queue.length;){var a=this.queue.shift();a.load()&&(this.requests_by_id[a.id]=a,this.open_request_count++);delete this.queue_by_id[a.id]}};l=d;var m;d=function(a,c){this.id=a.id;this.sort=parseInt(d3.select(a).style("z-index"));this.image=a;this.src=c};d.prototype.deny=function(){this.image=null};d.prototype.load=function(){return this.image&&this.image.parentNode?(this.image.src=this.src,!0):!1};d.compare=function(a,c){return c.sort-a.sort};m=d});
require.define("/Mouse.js",function(b,j,d){function e(a){var c=a.append("a");c.style("display","block").style("float","left").style("cursor","pointer").style("padding","7px").style("border-radius","3px").style("background-color","white").style("opacity",0.8).on("mouseover.button",function(){c.style("opacity",1)}).on("mouseout.button",function(){c.style("opacity",0.8)});return c}function g(){d3.event.preventDefault();d3.event.stopPropagation()}var c=b("./Core");d.element_size=function(a){return a==
document.body?new c.Point(window.innerWidth,window.innerHeight):new c.Point(a.clientWidth,a.clientHeight)};d.link_control=function(a,c){var b=a.append("div"),d=e(b),k=e(b);d.style("margin-right","5px");b.style("z-index",99).style("position","absolute").style("padding","5px").style("margin","5px").style("background-color","rgba(0, 0, 0, .2)").style("border-radius","6px");k.append("img").style("display","block").style("pointer-events","none").attr("src","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJAQMAAADaX5RTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFAAAA////pdmf3QAAAAJ0Uk5T/wDltzBKAAAAEUlEQVQI12N43MAAQXAAEwEAcZcIUxqnpLsAAAAASUVORK5CYII=");
d.append("img").style("display","block").style("pointer-events","none").attr("src","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJAQMAAADaX5RTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFAAAA////pdmf3QAAAAJ0Uk5T/wDltzBKAAAAEUlEQVQI12P438AAQXAAEwEAescI+0eupfwAAAAASUVORK5CYII=");a.on("dblclick.map",function(){c.onDoubleclick()});a.on("mousedown.map",function(){c.onMousedown()});a.on("mousewheel.map",function(){c.onMousewheel()});a.on("DOMMouseScroll.map",function(){c.onMousewheel()});
k.on("click.in",function(){c.onZoomin()}).on("dblclick.in",g);d.on("click.out",function(){c.onZoomout()}).on("dblclick.out",g)};b=function(a,c){this.map=a;this.whole_zooms=c};b.prototype.nextZoomIn=function(){var a=this.map.grid.zoom()+1;return this.whole_zooms?Math.round(a):a};b.prototype.nextZoomOut=function(){var a=this.map.grid.zoom()-1;return this.whole_zooms?Math.round(a):a};b.prototype.onZoomin=function(){this.map.grid.zoomToAbout(this.nextZoomIn(),this.map.grid.center);this.map.redraw(!0);
g()};b.prototype.onZoomout=function(){this.map.grid.zoomToAbout(this.nextZoomOut(),this.map.grid.center);this.map.redraw(!0);g()};b.prototype.onDoubleclick=function(){var a=d3.mouse(this.map.parent),a=new c.Point(a[0],a[1]),b=d3.event.shiftKey?this.nextZoomOut():this.nextZoomIn();this.map.grid.zoomToAbout(b,a);this.map.redraw(!0)};b.prototype.onMousedown=function(){var a=this,b=new c.Point(d3.event.pageX,d3.event.pageY);d3.select(window).on("mousemove.map",this.getOnMousemove(b)).on("mouseup.map",
function(){a.onMouseup()});g()};b.prototype.onMouseup=function(){d3.select(window).on("mousemove.map",null).on("mouseup.map",null)};b.prototype.getOnMousemove=function(a){var b=this.map,d=a;return function(){var a=new c.Point(d3.event.pageX,d3.event.pageY);b.grid.panBy(a.x-d.x,a.y-d.y);b.redraw(!0);d=a}};b.prototype.onMousewheel=function(){var a=d3.mouse(this.map.parent),a=new c.Point(a[0],a[1]),b=this.map.grid.zoom()+this.d3_behavior_zoom_delta();this.map.grid.zoomToAbout(b,a);this.map.redraw(!0);
g()};b.prototype.d3_behavior_zoom_delta=function(){this.d3_behavior_zoom_div||(this.d3_behavior_zoom_div=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);try{this.d3_behavior_zoom_div.scrollTop=250;this.d3_behavior_zoom_div.dispatchEvent(d3.event);var a=250-this.d3_behavior_zoom_div.scrollTop}catch(c){a=d3.event.wheelDelta||5*-d3.event.detail}return 0.003*
a};d.Control=b});
require.define("/Core.js",function(b,j,d){b=function(b,c){this.x=b;this.y=c};b.prototype.toString=function(){return"("+this.x.toFixed(3)+", "+this.y.toFixed(3)+")"};d.Point=b;var e=function(b,c,a){this.row=b;this.column=c;this.zoom=a};e.prototype.toString=function(){return"("+this.row.toFixed(3)+", "+this.column.toFixed(3)+" @"+this.zoom.toFixed(3)+")"};e.prototype.copy=function(){return new e(this.row,this.column,this.zoom)};e.prototype.container=function(){var b=this.zoomTo(Math.floor(this.zoom));return new e(Math.floor(b.row),
Math.floor(b.column),b.zoom)};e.prototype.zoomTo=function(b){var c=Math.pow(2,b-this.zoom);return new e(this.row*c,this.column*c,b)};e.prototype.zoomBy=function(b){var c=Math.pow(2,b);return new e(this.row*c,this.column*c,this.zoom+b)};e.prototype.up=function(b){"undefined"===typeof b&&(b=1);return new e(this.row-b,this.column,this.zoom)};e.prototype.right=function(b){"undefined"===typeof b&&(b=1);return new e(this.row,this.column+b,this.zoom)};e.prototype.down=function(b){"undefined"===typeof b&&
(b=1);return new e(this.row+b,this.column,this.zoom)};e.prototype.left=function(b){"undefined"===typeof b&&(b=1);return new e(this.row,this.column-b,this.zoom)};d.Coordinate=e});require.define("/Base.js",function(){});
require.define("/Tile.js",function(b,j,d){function e(c,a,b,e,g){if("WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix)return c=c||1,"translate3d("+[a.toFixed(0),b.toFixed(0),"0px"].join("px,")+") scale3d("+[c.toFixed(8),c.toFixed(8),"1"].join()+")";var k="MozTransform"==d.transform_property?"px":"";return"matrix("+[c||"1",0,0,c||"1",a+(e*c-e)+k,b+(g*c-g)+k].join()+")"}var g=b("./Grid");b=function(c,a){this.coord=c;this.grid=a};b.prototype.toString=function(){return[this.coord.toString(),
this.left(),this.top()].join(" ")};b.prototype.toKey=function(){return[Math.floor(this.coord.zoom),Math.floor(this.coord.column),Math.floor(this.coord.row)].join("/")};b.prototype.left=function(){var c=this.grid.coordinatePoint(this.coord.container());return Math.round(c.x)+"px"};b.prototype.top=function(){var c=this.grid.coordinatePoint(this.coord.container());return Math.round(c.y)+"px"};b.prototype.width=function(){var c=Math.pow(2,this.grid.zoom()-this.coord.zoom);return Math.ceil(c*g.TileSize)+
"px"};b.prototype.height=function(){var c=Math.pow(2,this.grid.zoom()-this.coord.zoom);return Math.ceil(c*g.TileSize)+"px"};b.prototype.transform=function(){var c=Math.pow(2,this.grid.zoom()-this.coord.zoom);c*g.TileSize%1&&(c+=(1-c*g.TileSize%1)/g.TileSize);var a=this.grid.roundCoord().zoomBy(this.coord.zoom-this.grid.roundCoord().zoom),b=Math.round(this.grid.center.x+(this.coord.column-a.column)*g.TileSize*c),a=Math.round(this.grid.center.y+(this.coord.row-a.row)*g.TileSize*c);return e(c,b,a,g.TileSize/
2,g.TileSize/2)};d.Tile=b;d.transform_property=null;"transform"in document.documentElement.style?d.transform_property="transform":"-webkit-transform"in document.documentElement.style?d.transform_property="-webkit-transform":"-o-transform"in document.documentElement.style?d.transform_property="-o-transform":"-moz-transform"in document.documentElement.style?d.transform_property="-moz-transform":"-ms-transform"in document.documentElement.style&&(d.transform_property="-ms-transform");d.matrix_string=
e});
require.define("/Grid.js",function(b,j,d){var e=b("./Core"),g=b("./Tile");d.TileSize=256;d.TileExp=Math.log(d.TileSize)/Math.log(2);b=function(c,a,b,d){this.resize(c,a);this.coord=b;this.pyramid=d};b.prototype.zoom=function(){return this.coord.zoom};b.prototype.roundCoord=function(){return this.coord.zoomTo(Math.round(this.coord.zoom))};b.prototype.resize=function(c,a){this.center=new e.Point(c/2,a/2)};b.prototype.panBy=function(c,a){var b=new e.Point(this.center.x-c,this.center.y-a);this.coord=this.pointCoordinate(b)};
b.prototype.zoomToAbout=function(c,a){var b=new e.Point(2*this.center.x-a.x,2*this.center.y-a.y);this.coord=this.pointCoordinate(new e.Point(a.x,a.y));this.coord=this.coord.zoomTo(c);18<this.coord.zoom?this.coord=this.coord.zoomTo(18):0>this.coord.zoom&&(this.coord=this.coord.zoomTo(0));this.coord=this.pointCoordinate(b)};b.prototype.coordinatePoint=function(c){var a=this.coord.zoomBy(d.TileExp);c=c.zoomTo(a.zoom);return new e.Point(this.center.x-a.column+c.column,this.center.y-a.row+c.row)};b.prototype.pointCoordinate=
function(c){var a=c.x-this.center.x;c=c.y-this.center.y;return this.coord.zoomBy(d.TileExp).right(a).down(c).zoomTo(this.coord.zoom)};b.prototype.visibleTiles=function(){for(var c=this.roundCoord(),a=this.pointCoordinate(new e.Point(0,0)),b=this.pointCoordinate(new e.Point(2*this.center.x,2*this.center.y)),a=a.zoomTo(c.zoom).container(),b=b.zoomTo(c.zoom).container(),d=[],j={},k=a.row;k<=b.row;k++)for(var n=a.column;n<=b.column;n++){var p=new e.Coordinate(k,n,c.zoom);d.push(new g.Tile(p,this));for(var l=
p.zoom-1;l>=p.zoom-this.pyramid&&0<=l;l--){var m=p.zoomTo(l).container();if(m.toString()in j)break;j[m.toString()]=!0;d.push(new g.Tile(m,this))}}return d};d.Grid=b});
require.define("/Div.js",function(b,j,d){function e(a){return a.toKey()}function g(a){return a.left()}function c(a){return a.top()}function a(a){return a.width()}function f(a){return a.height()}var h=b("./Mouse");b("./Base");var q=b("./Grid");b=function(a,b,c,d){this.selection=d3.select(a);this.parent=a;h.link_control(this.selection,new h.Control(this,!1));a=h.element_size(this.parent);c=b.locationCoordinate(c).zoomTo(d);this.grid=new q.Grid(a.x,a.y,c,0);this.projection=b;var e=this;d3.select(window).on("resize.map",
function(){e.update_gridsize()});this.selection.selectAll("div.tile").remove();this.redraw(!1)};b.prototype.update_gridsize=function(){var a=h.element_size(this.parent);this.grid.resize(a.x,a.y);this.redraw(!0)};b.prototype.pointLocation=function(a){"undefined"===typeof a&&(a=null);a=this.grid.pointCoordinate(a?a:this.grid.center);return this.projection.coordinateLocation(a)};b.prototype.locationPoint=function(a){a=this.projection.locationCoordinate(a);return this.grid.coordinatePoint(a)};b.prototype.onMoved=
function(a){var b=this,c=this.moved_callback;this.moved_callback=function(){c&&c();a(b)}};b.prototype.redraw=function(b){var d=this.grid.visibleTiles(),d=this.selection.selectAll("div.tile").data(d,e);d.exit().remove();d.enter().append("div").attr("class","tile").style("border-top","1px solid pink").style("border-left","1px solid pink").text(e).attr("id",e);this.selection.selectAll("div.tile").style("left",g).style("top",c).style("width",a).style("height",f);b&&this.moved_callback&&this.moved_callback()};
d.Map=b});
require.define("/Geo.js",function(b,j,d){var e=b("./Core"),g=function(a,b){this.lat=a;this.lon=b};g.prototype.toString=function(){return"("+this.lat.toFixed(6)+", "+this.lon.toFixed(6)+")"};d.Location=g;var c=Math.PI;b=function(){};b.prototype.project=function(a){var b=c*a.lon/180;a=Math.log(Math.tan(c/4+c*a.lat/180/2));return new e.Point(b,a)};b.prototype.inverse=function(a){var b=a.x;a=180*(2*Math.atan(Math.exp(a.y))-c/2)/c;return new g(a,180*b/c)};b.prototype.locationCoordinate=function(a,b){"undefined"===
typeof b&&(b=0);var d=this.project(a);return(new e.Coordinate((c-d.y)/(2*c),(d.x+c)/(2*c),0)).zoomTo(b)};b.prototype.coordinateLocation=function(a){a=a.zoomTo(0);return this.inverse(new e.Point(2*a.column*c-c,c-2*a.row*c))};d.Mercator=b});
require.define("/Map.js",function(b){var j=b("./Image"),d=b("./Div"),e=b("./Geo");window.pocketsquares={makeImgMap:function(b,c,a,d,h){if(b==document.body)throw Error("Sorry, for the moment I can\u2019t figure out how to make the mousewheel work in Safari 5.0 when the parent element is the document body. Try making your parent element a DIV?");return new j.Map(b,c,new e.Mercator,new e.Location(a,d),h)},makeDivMap:function(b,c,a,f){if(b==document.body)throw Error("Sorry, for the moment I can\u2019t figure out how to make the mousewheel work in Safari 5.0 when the parent element is the document body. Try making your parent element a DIV?");
return new d.Map(b,new e.Mercator,new e.Location(c,a),f)},Geo:{Mercator:e.Mercator}};void 0==window.ps&&(window.ps=window.pocketsquares)});require("/Map.js");
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>I Miss GetLatLon.com</title>
<script src="http://d3js.org/d3.v2.min.js"></script>
<script src="Grid.min.js"></script>
<link rel="stylesheet" href="http://www.openstreetmap.us/~migurski/style.css" />
<style title="text/css">
<!--
#map
{
border-top: 1px solid black;
border-bottom: 1px solid black;
width: 100%;
height: 350px;
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
}
#map-center
{
z-index: 99;
position: absolute;
top: 50%;
left: 50%;
}
#map-center img
{
position: absolute;
top: -16px;
left: -16px;
}
img.tile,
div.tile
{
display: block;
position: absolute;
margin: 0;
padding: 0;
border: 0;
-webkit-transform-origin: 0px 0px;
}
-->
</style>
</head>
<body>
<p>
I miss getlatlon.com.
</p>
<div id="map">
<div id="map-center"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhCAMAAABgOjJdAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFAAAA////pdmf3QAAAAJ0Uk5T/wDltzBKAAAAHUlEQVR42mJgRAMMowKjAkgChMFoiI0K4BEACDAAyNoEAWlto/IAAAAASUVORK5CYII="></div>
</div>
<pre id="info">
</pre>
<script type="application/javascript">
<!--
var info = document.getElementById('info');
function update_info(map)
{
var loc = map.pointLocation(),
lat = loc.lat,
lon = loc.lon,
zoom = map.grid.zoom(),
round = (Math.round(zoom) == zoom),
merc = new ps.Geo.Mercator(),
point = merc.project(loc),
x = 6378137 * point.x,
y = 6378137 * point.y,
coord = merc.locationCoordinate(loc).zoomTo(Math.round(zoom)).container(),
lines = [
'Lat, lon: ' + [lat.toFixed(7), lon.toFixed(7)].join(', '),
' X, Y: ' + [x.toFixed(1), y.toFixed(1)].join(', '),
' Zoom: ' + zoom.toFixed(0) + (round ? '' : ' (' + zoom.toFixed(2) + ')'),
' Tile: ' + [coord.zoom, coord.column, coord.row].join('/'),
' WKT’s: POINT (' + [lon.toFixed(9), lat.toFixed(9)].join(' ') + ')',
' POINT (' + [x.toFixed(3), y.toFixed(3)].join(' ') + ')',
]
info.innerText = lines.join('\n');
}
/*
var map = ps.makeDivMap(document.getElementById('map'), 37.804319, -122.271210, 12);
*/
var map = ps.makeImgMap(document.getElementById('map'),
'http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg',
37.804319, -122.271210, 12);
map.onMoved(update_info);
update_info(map);
//-->
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.