D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
tmcw
Full window
Github gist
MapMote bookmarklet
<center><a href='javascript:(function(){(function(){function t(){var e;e=document.getElementsByClassName("map-tile-loaded"),e.length||(e=document.getElementsByClassName("leaflet-tile"),e.length||(e=document.getElementsByClassName("olTileImage"),e.length||(e=document.getElementsByTagName("img"))));if(!e.length)return alert("No images found on this page");var t=[];for(var n=0;n<e.length;n++){var r=e[n];if(r.getAttribute("src")){var s=[];console.log(r.getAttribute("src")),s=r.getAttribute("src").match(/(\d+)\/(\d+)\/(\d+)/);if(!s||!s.length){var o=r.getAttribute("src"),u=o.match(/x=(\d+)/),a=o.match(/y=(\d+)/),f=o.match(/z=(\d+)/);u&&a&&f&&(s=[0,f[1],u[1],a[1]])}s&&s.length&&t.push({z:+s[1],x:+s[2],y:+s[3]})}}if(!t.length)return alert("No tiles found on this page");t.length&&i(t)}function n(e){var t=Infinity,n=Infinity,r=-Infinity,i=-Infinity;for(var s=0;s<e.length;s++)e[s][0]<t&&(t=e[s][0]),e[s][1]<n&&(n=e[s][1]),e[s][2]>r&&(r=e[s][2]),e[s][3]>i&&(i=e[s][3]);return[t,n,r,i]}function r(e){var t=document.body.appendChild(document.createElement("iframe"));t.style.width="0px",t.style.height="0px";var n=12;if(e[2]-e[0]>.01){var r=(e[0]+e[2])/2;e[0]=r-.005,e[2]=r+.005}if(e[3]-e[1]>.01){var i=(e[3]+e[1])/2;e[1]=i-.005,e[3]=i+.005}t.setAttribute("src","https://127.0.0.1:8111/load_and_zoom?left="+e[0].toFixed(n)+"&top="+e[3].toFixed(n)+"&right="+e[2].toFixed(n)+"&bottom="+e[1].toFixed(n))}function i(t){var i=new e,s=t[0].z,o=[];for(var u=0;u<t.length;u++){if(t[u].z!==s)continue;o.push(i.bbox(t[u].x,t[u].y,t[u].z))}o.length&&r(n(o))}var e=function(){function o(t){t=t||{},this.size=t.size||256;if(!e[this.size]){var n=this.size,r=e[this.size]={};r.Bc=[],r.Cc=[],r.zc=[],r.Ac=[];for(var i=0;i<30;i++)r.Bc.push(n/360),r.Cc.push(n/(2*Math.PI)),r.zc.push(n/2),r.Ac.push(n),n*=2}this.Bc=e[this.size].Bc,this.Cc=e[this.size].Cc,this.zc=e[this.size].zc,this.Ac=e[this.size].Ac}var e={},t=1e-10,n=Math.PI/180,r=180/Math.PI,i=6378137,s=20037508.34;return o.prototype.px=function(e,t){var r=this.zc[t],i=Math.min(Math.max(Math.sin(n*e[1]),-0.9999),.9999),s=Math.round(r+e[0]*this.Bc[t]),o=Math.round(r+.5*Math.log((1+i)/(1-i))*-this.Cc[t]);return s>this.Ac[t]&&(s=this.Ac[t]),o>this.Ac[t]&&(o=this.Ac[t]),[s,o]},o.prototype.ll=function(e,t){var n=(e[1]-this.zc[t])/-this.Cc[t],i=(e[0]-this.zc[t])/this.Bc[t],s=r*(2*Math.atan(Math.exp(n))-.5*Math.PI);return[i,s]},o.prototype.bbox=function(e,t,n,r,i){r&&(t=Math.pow(2,n)-1-t);var s=[e*this.size,(+t+1)*this.size],o=[(+e+1)*this.size,t*this.size],u=this.ll(s,n).concat(this.ll(o,n));return i==="900913"?this.convert(u,"900913"):u},o.prototype.xyz=function(e,t,n,r){r==="900913"&&(e=this.convert(e,"WGS84"));var i=[e[0],e[1]],s=[e[2],e[3]],o=this.px(i,t),u=this.px(s,t),a={minX:Math.floor(o[0]/this.size),minY:Math.floor(u[1]/this.size),maxX:Math.floor((u[0]-1)/this.size),maxY:Math.floor((o[1]-1)/this.size)};if(n){var f={minY:Math.pow(2,t)-1-a.maxY,maxY:Math.pow(2,t)-1-a.minY};a.minY=f.minY,a.maxY=f.maxY}return a},o.prototype.convert=function(e,t){return t==="900913"?this.forward(e.slice(0,2)).concat(this.forward(e.slice(2,4))):this.inverse(e.slice(0,2)).concat(this.inverse(e.slice(2,4)))},o.prototype.forward=function(e){var t=[i*e[0]*n,i*Math.log(Math.tan(Math.PI*.25+.5*e[1]*n))];return t[0]>s&&(t[0]=s),t[0]<-s&&(t[0]=-s),t[1]>s&&(t[1]=s),t[1]<-s&&(t[1]=-s),t},o.prototype.inverse=function(e){return[e[0]*r/i,(Math.PI*.5-2*Math.atan(Math.exp(-e[1]/i)))*r]},o}();typeof module!="undefined"&&typeof exports!="undefined"&&(module.exports=exports=e),t()})();})();'>mapmote</a></center>