Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-geo

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-geo - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

4

build/d3-geo.min.js

@@ -1,2 +0,2 @@

// https://d3js.org/d3-geo/ Version 0.0.4. Copyright 2016 Mike Bostock.
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],t):t(n.d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";function r(){return new i}function i(){this.reset()}function e(n,t,r){var i=n.s=t+r,e=i-t,o=i-e;n.t=t-o+(r-e)}function o(n){return n>1?0:n<-1?gr:Math.acos(n)}function u(n){return n>1?hr:n<-1?-hr:Math.asin(n)}function c(n){return(n=Cr(n/2))*n}function f(){}function a(n,t){n&&Rr.hasOwnProperty(n.type)&&Rr[n.type](n,t)}function l(n,t,r){var i,e=-1,o=n.length-r;for(t.lineStart();++e<o;)i=n[e],t.point(i[0],i[1],i[2]);t.lineEnd()}function p(n,t){var r=-1,i=n.length;for(t.polygonStart();++r<i;)l(n[r],t,1);t.polygonEnd()}function s(n,t){n&&Lr.hasOwnProperty(n.type)?Lr[n.type](n,t):a(n,t)}function v(){Or.point=h}function g(){d(Rt,Ot)}function h(n,t){Or.point=d,Rt=n,Ot=t,n*=yr,t*=yr,Tt=n,Gt=Nr(t=t/2+dr),Ft=Cr(t)}function d(n,t){n*=yr,t*=yr,t=t/2+dr;var r=n-Tt,i=r>=0?1:-1,e=i*r,o=Nr(t),u=Cr(t),c=Ft*u,f=Gt*o+c*Nr(e),a=c*i*Cr(e);zt.add(xr(a,f)),Tt=n,Gt=o,Ft=u}function E(n){return Lt?Lt.reset():(Lt=r(),zt=r()),s(n,Or),2*Lt}function S(n){return[xr(n[1],n[0]),u(n[2])]}function y(n){var t=n[0],r=n[1],i=Nr(r);return[i*Nr(t),i*Cr(t),Cr(r)]}function m(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function M(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function x(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function N(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function j(n){var t=qr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function w(n,t){Kt.push(Qt=[It=n,Bt=n]),t<_t&&(_t=t),t>Dt&&(Dt=t)}function P(n,t){var r=y([n*yr,t*yr]);if(Ht){var i=M(Ht,r),e=[i[1],-i[0],0],o=M(e,i);j(o),o=S(o);var u,c=n-Ut,f=c>0?1:-1,a=o[0]*Sr*f,l=mr(c)>180;l^(f*Ut<a&&a<f*n)?(u=o[1]*Sr,u>Dt&&(Dt=u)):(a=(a+360)%360-180,l^(f*Ut<a&&a<f*n)?(u=-o[1]*Sr,u<_t&&(_t=u)):(t<_t&&(_t=t),t>Dt&&(Dt=t))),l?n<Ut?L(It,n)>L(It,Bt)&&(Bt=n):L(n,Bt)>L(It,Bt)&&(It=n):Bt>=It?(n<It&&(It=n),n>Bt&&(Bt=n)):n>Ut?L(It,n)>L(It,Bt)&&(Bt=n):L(n,Bt)>L(It,Bt)&&(It=n)}else w(n,t);Ht=r,Ut=n}function A(){Tr.point=P}function C(){Qt[0]=It,Qt[1]=Bt,Tr.point=w,Ht=null}function b(n,t){if(Ht){var r=n-Ut;Jt.add(mr(r)>180?r+(r>0?360:-360):r)}else Zt=n,kt=t;Or.point(n,t),P(n,t)}function q(){Or.lineStart()}function z(){b(Zt,kt),Or.lineEnd(),mr(Jt)>sr&&(It=-(Bt=180)),Qt[0]=It,Qt[1]=Bt,Ht=null}function L(n,t){return(t-=n)<0?t+360:t}function R(n,t){return n[0]-t[0]}function O(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}function T(n){var t,i,e,o,u,c,f;if(Jt?Jt.reset():Jt=r(),Dt=Bt=-(It=_t=1/0),Kt=[],s(n,Tr),i=Kt.length){for(Kt.sort(R),t=1,e=Kt[0],u=[e];t<i;++t)o=Kt[t],O(e,o[0])||O(e,o[1])?(L(e[0],o[1])>L(e[0],e[1])&&(e[1]=o[1]),L(o[0],e[1])>L(e[0],e[1])&&(e[0]=o[0])):u.push(e=o);for(c=-(1/0),i=u.length-1,t=0,e=u[i];t<=i;e=o,++t)o=u[t],(f=L(e[1],o[0]))>c&&(c=f,It=o[0],Bt=e[1])}return Kt=Qt=null,It===1/0||_t===1/0?[[NaN,NaN],[NaN,NaN]]:[[It,_t],[Bt,Dt]]}function G(n,t){n*=yr,t*=yr;var r=Nr(t);F(r*Nr(n),r*Cr(n),Cr(t))}function F(n,t,r){++Vt,Xt+=(n-Xt)/Vt,Yt+=(t-Yt)/Vt,$t+=(r-$t)/Vt}function I(){Gr.point=_}function _(n,t){n*=yr,t*=yr;var r=Nr(t);fr=r*Nr(n),ar=r*Cr(n),lr=Cr(t),Gr.point=B,F(fr,ar,lr)}function B(n,t){n*=yr,t*=yr;var r=Nr(t),i=r*Nr(n),e=r*Cr(n),o=Cr(t),u=xr(qr((u=ar*o-lr*e)*u+(u=lr*i-fr*o)*u+(u=fr*e-ar*i)*u),fr*i+ar*e+lr*o);Wt+=u,nr+=u*(fr+(fr=i)),tr+=u*(ar+(ar=e)),rr+=u*(lr+(lr=o)),F(fr,ar,lr)}function D(){Gr.point=G}function U(){Gr.point=k}function Z(){H(ur,cr),Gr.point=G}function k(n,t){ur=n,cr=t,n*=yr,t*=yr,Gr.point=H;var r=Nr(t);fr=r*Nr(n),ar=r*Cr(n),lr=Cr(t),F(fr,ar,lr)}function H(n,t){n*=yr,t*=yr;var r=Nr(t),i=r*Nr(n),e=r*Cr(n),u=Cr(t),c=ar*u-lr*e,f=lr*i-fr*u,a=fr*e-ar*i,l=qr(c*c+f*f+a*a),p=fr*i+ar*e+lr*u,s=l&&-o(p)/l,v=xr(l,p);ir+=s*c,er+=s*f,or+=s*a,Wt+=v,nr+=v*(fr+(fr=i)),tr+=v*(ar+(ar=e)),rr+=v*(lr+(lr=u)),F(fr,ar,lr)}function J(n){Vt=Wt=Xt=Yt=$t=nr=tr=rr=ir=er=or=0,s(n,Gr);var t=ir,r=er,i=or,e=t*t+r*r+i*i;return e<vr&&(t=nr,r=tr,i=rr,Wt<sr&&(t=Xt,r=Yt,i=$t),e=t*t+r*r+i*i,e<vr)?[NaN,NaN]:[xr(r,t)*Sr,u(i/qr(e))*Sr]}function K(n){return function(){return n}}function Q(n,t){function r(r,i){return r=n(r,i),t(r[0],r[1])}return n.invert&&t.invert&&(r.invert=function(r,i){return r=t.invert(r,i),r&&n.invert(r[0],r[1])}),r}function V(n,t){return[n>gr?n-Er:n<-gr?n+Er:n,t]}function W(n,t,r){return(n%=Er)?t||r?Q(Y(n),$(t,r)):Y(n):t||r?$(t,r):V}function X(n){return function(t,r){return t+=n,[t>gr?t-Er:t<-gr?t+Er:t,r]}}function Y(n){var t=X(n);return t.invert=X(-n),t}function $(n,t){function r(n,t){var r=Nr(t),f=Nr(n)*r,a=Cr(n)*r,l=Cr(t),p=l*i+f*e;return[xr(a*o-p*c,f*i-l*e),u(p*o+a*c)]}var i=Nr(n),e=Cr(n),o=Nr(t),c=Cr(t);return r.invert=function(n,t){var r=Nr(t),f=Nr(n)*r,a=Cr(n)*r,l=Cr(t),p=l*o-a*c;return[xr(a*o+l*c,f*i+p*e),u(p*i-f*e)]},r}function nn(n){function t(t){return t=n(t[0]*yr,t[1]*yr),t[0]*=Sr,t[1]*=Sr,t}return n=W(n[0]*yr,n[1]*yr,n.length>2?n[2]*yr:0),t.invert=function(t){return t=n.invert(t[0]*yr,t[1]*yr),t[0]*=Sr,t[1]*=Sr,t},t}function tn(n,t,r,i,e,o){if(r){var u=Nr(t),c=Cr(t),f=i*r;null==e?(e=t+i*Er,o=t-f/2):(e=rn(u,e),o=rn(u,o),(i>0?e<o:e>o)&&(e+=i*Er));for(var a,l=e;i>0?l>o:l<o;l-=f)a=S([u,-c*Nr(l),-c*Cr(l)]),n.point(a[0],a[1])}}function rn(n,t){t=y(t),t[0]-=n,j(t);var r=o(-t[1]);return((-t[2]<0?-r:r)+Er-sr)%Er}function en(){function n(n,t){r.push(n=i(n,t)),n[0]*=Sr,n[1]*=Sr}function t(){var n=e.apply(this,arguments),t=o.apply(this,arguments)*yr,f=u.apply(this,arguments)*yr;return r=[],i=W(-n[0]*yr,-n[1]*yr,0).invert,tn(c,t,f,1),n={type:"Polygon",coordinates:[r]},r=i=null,n}var r,i,e=K([0,0]),o=K(90),u=K(6),c={point:n};return t.center=function(n){return arguments.length?(e="function"==typeof n?n:K([+n[0],+n[1]]),t):e},t.radius=function(n){return arguments.length?(o="function"==typeof n?n:K(+n),t):o},t.precision=function(n){return arguments.length?(u="function"==typeof n?n:K(+n),t):u},t}function on(){var n,t=[];return{point:function(t,r){n.push([t,r])},lineStart:function(){t.push(n=[])},lineEnd:f,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}}function un(n,t,r,i,e,o){var u,c=n[0],f=n[1],a=t[0],l=t[1],p=0,s=1,v=a-c,g=l-f;if(u=r-c,v||!(u>0)){if(u/=v,v<0){if(u<p)return;u<s&&(s=u)}else if(v>0){if(u>s)return;u>p&&(p=u)}if(u=e-c,v||!(u<0)){if(u/=v,v<0){if(u>s)return;u>p&&(p=u)}else if(v>0){if(u<p)return;u<s&&(s=u)}if(u=i-f,g||!(u>0)){if(u/=g,g<0){if(u<p)return;u<s&&(s=u)}else if(g>0){if(u>s)return;u>p&&(p=u)}if(u=o-f,g||!(u<0)){if(u/=g,g<0){if(u>s)return;u>p&&(p=u)}else if(g>0){if(u<p)return;u<s&&(s=u)}return p>0&&(n[0]=c+p*v,n[1]=f+p*g),s<1&&(t[0]=c+s*v,t[1]=f+s*g),!0}}}}}function cn(n,t){return mr(n[0]-t[0])<sr&&mr(n[1]-t[1])<sr}function fn(n,t,r,i){this.x=n,this.z=t,this.o=r,this.e=i,this.v=!1,this.n=this.p=null}function an(n,t,r,i,e){var o,u,c=[],f=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,r,i=n[0],u=n[t];if(cn(i,u)){for(e.lineStart(),o=0;o<t;++o)e.point((i=n[o])[0],i[1]);return void e.lineEnd()}c.push(r=new fn(i,n,null,(!0))),f.push(r.o=new fn(i,null,r,(!1))),c.push(r=new fn(u,n,null,(!1))),f.push(r.o=new fn(u,null,r,(!0)))}}),c.length){for(f.sort(t),ln(c),ln(f),o=0,u=f.length;o<u;++o)f[o].e=r=!r;for(var a,l,p=c[0];;){for(var s=p,v=!0;s.v;)if((s=s.n)===p)return;a=s.z,e.lineStart();do{if(s.v=s.o.v=!0,s.e){if(v)for(o=0,u=a.length;o<u;++o)e.point((l=a[o])[0],l[1]);else i(s.x,s.n.x,1,e);s=s.n}else{if(v)for(a=s.p.z,o=a.length-1;o>=0;--o)e.point((l=a[o])[0],l[1]);else i(s.x,s.p.x,-1,e);s=s.p}s=s.o,a=s.z,v=!v}while(!s.v);e.lineEnd()}}}function ln(n){if(t=n.length){for(var t,r,i=0,e=n[0];++i<t;)e.n=r=n[i],r.p=e,e=r;e.n=r=n[0],r.p=e}}function pn(n,r,i,e){function o(t,o){return n<=t&&t<=i&&r<=o&&o<=e}function u(t,o,u,f){var l=0,p=0;if(null==t||(l=c(t,u))!==(p=c(o,u))||a(t,o)<0^u>0){do f.point(0===l||3===l?n:i,l>1?e:r);while((l=(l+u+4)%4)!==p)}else f.point(o[0],o[1])}function c(t,e){return mr(t[0]-n)<sr?e>0?0:3:mr(t[0]-i)<sr?e>0?2:1:mr(t[1]-r)<sr?e>0?1:0:e>0?3:2}function f(n,t){return a(n.x,t.x)}function a(n,t){var r=c(n,1),i=c(t,1);return r!==i?r-i:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(c){function a(n,t){o(n,t)&&A.point(n,t)}function l(){for(var t=0,r=0,i=E.length;r<i;++r)for(var o,u,c=E[r],f=1,a=c.length,l=c[0],p=l[0],s=l[1];f<a;++f)o=p,u=s,l=c[f],p=l[0],s=l[1],u<=e?s>e&&(p-o)*(e-u)>(s-u)*(n-o)&&++t:s<=e&&(p-o)*(e-u)<(s-u)*(n-o)&&--t;return t}function p(){A=C,d=[],E=[],P=!0}function s(){var n=l(),r=P&&n,i=(d=t.merge(d)).length;(r||i)&&(c.polygonStart(),r&&(c.lineStart(),u(null,null,1,c),c.lineEnd()),i&&an(d,f,n,u,c),c.polygonEnd()),A=c,d=E=S=null}function v(){b.point=h,E&&E.push(S=[]),w=!0,j=!1,x=N=NaN}function g(){d&&(h(y,m),M&&j&&C.rejoin(),d.push(C.result())),b.point=a,j&&A.lineEnd()}function h(t,u){var c=o(t,u);if(E&&S.push([t,u]),w)y=t,m=u,M=c,w=!1,c&&(A.lineStart(),A.point(t,u));else if(c&&j)A.point(t,u);else{var f=[x=Math.max(Wr,Math.min(Vr,x)),N=Math.max(Wr,Math.min(Vr,N))],a=[t=Math.max(Wr,Math.min(Vr,t)),u=Math.max(Wr,Math.min(Vr,u))];un(f,a,n,r,i,e)?(j||(A.lineStart(),A.point(f[0],f[1])),A.point(a[0],a[1]),c||A.lineEnd(),P=!1):c&&(A.lineStart(),A.point(t,u),P=!1)}x=t,N=u,j=c}var d,E,S,y,m,M,x,N,j,w,P,A=c,C=on(),b={point:a,lineStart:v,lineEnd:g,polygonStart:p,polygonEnd:s};return b}}function sn(){var n,t,r,i=0,e=0,o=960,u=500;return r={stream:function(r){return n&&t===r?n:n=pn(i,e,o,u)(t=r)},extent:function(c){return arguments.length?(i=+c[0][0],e=+c[0][1],o=+c[1][0],u=+c[1][1],n=t=null,r):[[i,e],[o,u]]}}}function vn(){Xr.point=hn,Xr.lineEnd=gn}function gn(){Xr.point=Xr.lineEnd=f}function hn(n,t){n*=yr,t*=yr,Ir=n,_r=Cr(t),Br=Nr(t),Xr.point=dn}function dn(n,t){n*=yr,t*=yr;var r=Cr(t),i=Nr(t),e=mr(n-Ir),o=Nr(e),u=Cr(e),c=i*u,f=Br*r-_r*i*o,a=_r*r+Br*i*o;Fr.add(xr(qr(c*c+f*f),a)),Ir=n,_r=r,Br=i}function En(n){return Fr?Fr.reset():Fr=r(),s(n,Xr),+Fr}function Sn(n,t){return Yr[0]=n,Yr[1]=t,En($r)}function yn(n,r,i){var e=t.range(n,r-sr,i).concat(r);return function(n){return e.map(function(t){return[n,t]})}}function mn(n,r,i){var e=t.range(n,r-sr,i).concat(r);return function(n){return e.map(function(t){return[t,n]})}}function Mn(){function n(){return{type:"MultiLineString",coordinates:r()}}function r(){return t.range(jr(u/E)*E,o,E).map(v).concat(t.range(jr(l/S)*S,a,S).map(g)).concat(t.range(jr(e/h)*h,i,h).filter(function(n){return mr(n%E)>sr}).map(p)).concat(t.range(jr(f/d)*d,c,d).filter(function(n){return mr(n%S)>sr}).map(s))}var i,e,o,u,c,f,a,l,p,s,v,g,h=10,d=h,E=90,S=360,y=2.5;return n.lines=function(){return r().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[v(u).concat(g(a).slice(1),v(o).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.extentMajor(t).extentMinor(t):n.extentMinor()},n.extentMajor=function(t){return arguments.length?(u=+t[0][0],o=+t[1][0],l=+t[0][1],a=+t[1][1],u>o&&(t=u,u=o,o=t),l>a&&(t=l,l=a,a=t),n.precision(y)):[[u,l],[o,a]]},n.extentMinor=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],f=+t[0][1],c=+t[1][1],e>i&&(t=e,e=i,i=t),f>c&&(t=f,f=c,c=t),n.precision(y)):[[e,f],[i,c]]},n.step=function(t){return arguments.length?n.stepMajor(t).stepMinor(t):n.stepMinor()},n.stepMajor=function(t){return arguments.length?(E=+t[0],S=+t[1],n):[E,S]},n.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],n):[h,d]},n.precision=function(t){return arguments.length?(y=+t,p=yn(f,c,90),s=mn(e,i,y),v=yn(l,a,90),g=mn(u,o,y),n):y},n.extentMajor([[-180,-90+sr],[180,90-sr]]).extentMinor([[-180,-80-sr],[180,80+sr]])}function xn(n,t){var r=n[0]*yr,i=n[1]*yr,e=t[0]*yr,o=t[1]*yr,f=Nr(i),a=Cr(i),l=Nr(o),p=Cr(o),s=f*Nr(r),v=f*Cr(r),g=l*Nr(e),h=l*Cr(e),d=2*u(qr(c(o-i)+f*l*c(e-r))),E=Cr(d),S=d?function(n){var t=Cr(n*=d)/E,r=Cr(d-n)/E,i=r*s+t*g,e=r*v+t*h,o=r*a+t*p;return[xr(e,i)*Sr,xr(o,qr(i*i+e*e))*Sr]}:function(){return[r*Sr,i*Sr]};return S.distance=d,S}function Nn(n){return n}function jn(){ri.point=wn}function wn(n,t){ri.point=Pn,Dr=Zr=n,Ur=kr=t}function Pn(n,t){ti.add(kr*n-Zr*t),Zr=n,kr=t}function An(){Pn(Dr,Ur)}function Cn(n,t){n<ii&&(ii=n),n>oi&&(oi=n),t<ei&&(ei=t),t>ui&&(ui=t)}function bn(n,t){fi+=n,ai+=t,++li}function qn(){Ei.point=zn}function zn(n,t){Ei.point=Ln,bn(Kr=n,Qr=t)}function Ln(n,t){var r=n-Kr,i=t-Qr,e=qr(r*r+i*i);pi+=e*(Kr+n)/2,si+=e*(Qr+t)/2,vi+=e,bn(Kr=n,Qr=t)}function Rn(){Ei.point=bn}function On(){Ei.point=Gn}function Tn(){Fn(Hr,Jr)}function Gn(n,t){Ei.point=Fn,bn(Hr=Kr=n,Jr=Qr=t)}function Fn(n,t){var r=n-Kr,i=t-Qr,e=qr(r*r+i*i);pi+=e*(Kr+n)/2,si+=e*(Qr+t)/2,vi+=e,e=Qr*n-Kr*t,gi+=e*(Kr+n),hi+=e*(Qr+t),di+=3*e,bn(Kr=n,Qr=t)}function In(n){function t(t,r){n.moveTo(t+u,r),n.arc(t,r,u,0,Er)}function r(t,r){n.moveTo(t,r),c.point=i}function i(t,r){n.lineTo(t,r)}function e(){c.point=t}function o(){n.closePath()}var u=4.5,c={point:t,lineStart:function(){c.point=r},lineEnd:e,polygonStart:function(){c.lineEnd=o},polygonEnd:function(){c.lineEnd=e,c.point=t},pointRadius:function(n){return u=n,c},result:f};return c}function _n(){function n(n,t){c.push("M",n,",",t,u)}function t(n,t){c.push("M",n,",",t),f.point=r}function r(n,t){c.push("L",n,",",t)}function i(){f.point=t}function e(){f.point=n}function o(){c.push("Z")}var u=Bn(4.5),c=[],f={point:n,lineStart:i,lineEnd:e,polygonStart:function(){f.lineEnd=o},polygonEnd:function(){f.lineEnd=e,f.point=n},pointRadius:function(n){return u=Bn(n),f},result:function(){if(c.length){var n=c.join("");return c=[],n}}};return f}function Bn(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Dn(){function n(n){return n&&("function"==typeof o&&e.pointRadius(+o.apply(this,arguments)),s(n,i(e))),e.result()}var t,r,i,e,o=4.5;return n.area=function(n){return s(n,i(ri)),ri.result()},n.bounds=function(n){return s(n,i(ci)),ci.result()},n.centroid=function(n){return s(n,i(Ei)),Ei.result()},n.projection=function(r){return arguments.length?(i=(t=r)?r.stream:Nn,n):t},n.context=function(t){return arguments.length?(e=null==(r=t)?new _n:new In(t),"function"!=typeof o&&e.pointRadius(o),n):r},n.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(e.pointRadius(+t),+t),n):o},n.projection(null).context(null)}function Un(n,t){for(var r=t[0],i=t[1],e=[Cr(r),-Nr(r),0],o=0,c=0,f=0,a=n.length;f<a;++f)if(p=(l=n[f]).length)for(var l,p,s=l[p-1],v=s[0],g=s[1]/2+dr,h=Cr(g),d=Nr(g),E=0;E<p;++E,v=m,h=N,d=w,s=S){var S=l[E],m=S[0],x=S[1]/2+dr,N=Cr(x),w=Nr(x),P=m-v,A=P>=0?1:-1,C=A*P,b=C>gr,q=h*N;if(Si.add(xr(q*A*Cr(C),d*w+q*Nr(C))),o+=b?P+A*Er:P,b^v>=r^m>=r){var z=M(y(s),y(S));j(z);var L=M(e,z);j(L);var R=(b^P>=0?-1:1)*u(L[2]);(i>R||i===R&&(z[0]||z[1]))&&(c+=b^P>=0?1:-1)}}var O=(o<-sr||o<sr&&Si<-sr)^1&c;return Si.reset(),O}function Zn(n,r,i,e){return function(o,u){function c(t,r){var i=o(t,r);n(t=i[0],r=i[1])&&u.point(t,r)}function f(n,t){var r=o(n,t);E.point(r[0],r[1])}function a(){x.point=f,E.lineStart()}function l(){x.point=c,E.lineEnd()}function p(n,t){d.push([n,t]);var r=o(n,t);m.point(r[0],r[1])}function s(){m.lineStart(),d=[]}function v(){p(d[0][0],d[0][1]),m.lineEnd();var n,t,r,i,e=m.clean(),o=y.result(),c=o.length;if(d.pop(),g.push(d),d=null,c)if(1&e){if(r=o[0],(t=r.length-1)>0){for(M||(u.polygonStart(),M=!0),u.lineStart(),n=0;n<t;++n)u.point((i=r[n])[0],i[1]);u.lineEnd()}}else c>1&&2&e&&o.push(o.pop().concat(o.shift())),h.push(o.filter(kn))}var g,h,d,E=r(u),S=o.invert(e[0],e[1]),y=on(),m=r(y),M=!1,x={point:c,lineStart:a,lineEnd:l,polygonStart:function(){x.point=p,x.lineStart=s,x.lineEnd=v,h=[],g=[]},polygonEnd:function(){x.point=c,x.lineStart=a,x.lineEnd=l,h=t.merge(h);var n=Un(g,S);h.length?(M||(u.polygonStart(),M=!0),an(h,Hn,n,i,u)):n&&(M||(u.polygonStart(),M=!0),u.lineStart(),i(null,null,1,u),u.lineEnd()),M&&(u.polygonEnd(),M=!1),h=g=null},sphere:function(){u.polygonStart(),u.lineStart(),i(null,null,1,u),u.lineEnd(),u.polygonEnd()}};return x}}function kn(n){return n.length>1}function Hn(n,t){return((n=n.x)[0]<0?n[1]-hr-sr:hr-n[1])-((t=t.x)[0]<0?t[1]-hr-sr:hr-t[1])}function Jn(n){var t,r=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var c=o>0?gr:-gr,f=mr(o-r);mr(f-gr)<sr?(n.point(r,i=(i+u)/2>0?hr:-hr),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),n.point(o,i),t=0):e!==c&&f>=gr&&(mr(r-e)<sr&&(r-=e*sr),mr(o-c)<sr&&(o-=c*sr),i=Kn(r,i,o,u),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),t=0),n.point(r=o,i=u),e=c},lineEnd:function(){n.lineEnd(),r=i=NaN},clean:function(){return 2-t}}}function Kn(n,t,r,i){var e,o,u=Cr(n-r);return mr(u)>sr?Mr((Cr(t)*(o=Nr(i))*Cr(r)-Cr(i)*(e=Nr(t))*Cr(n))/(e*o*u)):(t+i)/2}function Qn(n,t,r,i){var e;if(null==n)e=r*hr,i.point(-gr,e),i.point(0,e),i.point(gr,e),i.point(gr,0),i.point(gr,-e),i.point(0,-e),i.point(-gr,-e),i.point(-gr,0),i.point(-gr,e);else if(mr(n[0]-t[0])>sr){var o=n[0]<t[0]?gr:-gr;e=r*o/2,i.point(-o,e),i.point(0,e),i.point(o,e)}else i.point(t[0],t[1])}function Vn(n,t){function r(r,i,e,o){tn(o,n,t,e,r,i)}function i(n,t){return Nr(n)*Nr(t)>c}function e(n){var t,r,e,c,l;return{lineStart:function(){c=e=!1,l=1},point:function(p,s){var v,g=[p,s],h=i(p,s),d=f?h?0:u(p,s):h?u(p+(p<0?gr:-gr),s):0;if(!t&&(c=e=h)&&n.lineStart(),h!==e&&(v=o(t,g),(cn(t,v)||cn(g,v))&&(g[0]+=sr,g[1]+=sr,h=i(g[0],g[1]))),h!==e)l=0,h?(n.lineStart(),v=o(g,t),n.point(v[0],v[1])):(v=o(t,g),n.point(v[0],v[1]),n.lineEnd()),t=v;else if(a&&t&&f^h){var E;d&r||!(E=o(g,t,!0))||(l=0,f?(n.lineStart(),n.point(E[0][0],E[0][1]),n.point(E[1][0],E[1][1]),n.lineEnd()):(n.point(E[1][0],E[1][1]),n.lineEnd(),n.lineStart(),n.point(E[0][0],E[0][1])))}!h||t&&cn(t,g)||n.point(g[0],g[1]),t=g,e=h,r=d},lineEnd:function(){e&&n.lineEnd(),t=null},clean:function(){return l|(c&&e)<<1}}}function o(n,t,r){var i=y(n),e=y(t),o=[1,0,0],u=M(i,e),f=m(u,u),a=u[0],l=f-a*a;if(!l)return!r&&n;var p=c*f/l,s=-c*a/l,v=M(o,u),g=N(o,p),h=N(u,s);x(g,h);var d=v,E=m(g,d),j=m(d,d),w=E*E-j*(m(g,g)-1);if(!(w<0)){var P=qr(w),A=N(d,(-E-P)/j);if(x(A,g),A=S(A),!r)return A;var C,b=n[0],q=t[0],z=n[1],L=t[1];q<b&&(C=b,b=q,q=C);var R=q-b,O=mr(R-gr)<sr,T=O||R<sr;if(!O&&L<z&&(C=z,z=L,L=C),T?O?z+L>0^A[1]<(mr(A[0]-b)<sr?z:L):z<=A[1]&&A[1]<=L:R>gr^(b<=A[0]&&A[0]<=q)){var G=N(d,(-E+P)/j);return x(G,g),[A,S(G)]}}}function u(t,r){var i=f?n:gr-n,e=0;return t<-i?e|=1:t>i&&(e|=2),r<-i?e|=4:r>i&&(e|=8),e}var c=Nr(n),f=c>0,a=mr(c)>sr;return Zn(i,e,r,f?[0,-n]:[-gr,n-gr])}function Wn(n){function t(){}var r=t.prototype=Object.create(Xn.prototype);for(var i in n)r[i]=n[i];return function(n){var r=new t;return r.stream=n,r}}function Xn(){}function Yn(n,t){return+t?nt(n,t):$n(n)}function $n(n){return Wn({point:function(t,r){t=n(t,r),this.stream.point(t[0],t[1])}})}function nt(n,t){function r(i,e,o,c,f,a,l,p,s,v,g,h,d,E){var S=l-i,y=p-e,m=S*S+y*y;if(m>4*t&&d--){var M=c+v,x=f+g,N=a+h,j=qr(M*M+x*x+N*N),w=u(N/=j),P=mr(mr(N)-1)<sr||mr(o-s)<sr?(o+s)/2:xr(x,M),A=n(P,w),C=A[0],b=A[1],q=C-i,z=b-e,L=y*q-S*z;(L*L/m>t||mr((S*q+y*z)/m-.5)>.3||c*v+f*g+a*h<Mi)&&(r(i,e,o,c,f,a,C,b,P,M/=j,x/=j,N,d,E),E.point(C,b),r(C,b,P,M,x,N,l,p,s,v,g,h,d,E))}}return function(t){function i(r,i){r=n(r,i),t.point(r[0],r[1])}function e(){E=NaN,N.point=o,t.lineStart()}function o(i,e){var o=y([i,e]),u=n(i,e);r(E,S,d,m,M,x,E=u[0],S=u[1],d=i,m=o[0],M=o[1],x=o[2],mi,t),t.point(E,S)}function u(){N.point=i,t.lineEnd()}function c(){e(),N.point=f,N.lineEnd=a}function f(n,t){o(l=n,t),p=E,s=S,v=m,g=M,h=x,N.point=o}function a(){r(E,S,d,m,M,x,p,s,l,v,g,h,mi,t),N.lineEnd=u,u()}var l,p,s,v,g,h,d,E,S,m,M,x,N={point:i,lineStart:e,lineEnd:u,polygonStart:function(){t.polygonStart(),N.lineStart=c},polygonEnd:function(){t.polygonEnd(),N.lineStart=e}};return N}}function tt(n){return rt(function(){return n})()}function rt(n){function t(n){return n=l(n[0]*yr,n[1]*yr),[n[0]*d+c,f-n[1]*d]}function r(n){return n=l.invert((n[0]-c)/d,(f-n[1])/d),n&&[n[0]*Sr,n[1]*Sr]}function i(n,t){return n=u(n,t),[n[0]*d+c,f-n[1]*d]}function e(){l=Q(a=W(M,x,N),u);var n=u(y,m);return c=E-n[0]*d,f=S+n[1]*d,o()}function o(){return g=h=null,t}var u,c,f,a,l,p,s,v,g,h,d=150,E=480,S=250,y=0,m=0,M=0,x=0,N=0,j=null,w=yi,P=null,A=Nn,C=.5,b=Yn(i,C);return t.stream=function(n){return g&&h===n?g:g=xi(w(a,b(A(h=n))))},t.clipAngle=function(n){return arguments.length?(w=+n?Vn(j=n*yr,6*yr):(j=null,yi),o()):j*Sr},t.clipExtent=function(n){return arguments.length?(A=null==n?(P=p=s=v=null,Nn):pn(P=+n[0][0],p=+n[0][1],s=+n[1][0],v=+n[1][1]),o()):null==P?null:[[P,p],[s,v]]},t.scale=function(n){return arguments.length?(d=+n,e()):d},t.translate=function(n){return arguments.length?(E=+n[0],S=+n[1],e()):[E,S]},t.center=function(n){return arguments.length?(y=n[0]%360*yr,m=n[1]%360*yr,e()):[y*Sr,m*Sr]},t.rotate=function(n){return arguments.length?(M=n[0]%360*yr,x=n[1]%360*yr,N=n.length>2?n[2]%360*yr:0,e()):[M*Sr,x*Sr,N*Sr]},t.precision=function(n){return arguments.length?(b=Yn(i,C=n*n),o()):qr(C)},function(){return u=n.apply(this,arguments),t.invert=u.invert&&r,e()}}function it(n){var t=0,r=gr/3,i=rt(n),e=i(t,r);return e.parallels=function(n){return arguments.length?i(t=n[0]*yr,r=n[1]*yr):[t*Sr,r*Sr]},e}function et(n,t){function r(n,t){var r=qr(o-2*e*Cr(t))/e;return[r*Cr(n*=e),c-r*Nr(n)]}var i=Cr(n),e=(i+Cr(t))/2,o=1+i*(2*e-i),c=qr(o)/e;return r.invert=function(n,t){var r=c-t;return[xr(n,r)/e,u((o-(n*n+r*r)*e*e)/(2*e))]},r}function ot(){return it(et).scale(151).translate([480,347])}function ut(){return ot().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function ct(n){var t=n.length;return{point:function(r,i){for(var e=-1;++e<t;)n[e].point(r,i)},sphere:function(){for(var r=-1;++r<t;)n[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)n[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)n[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)n[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)n[r].polygonEnd()}}}function ft(){function n(n){var t=n[0],r=n[1];return u=null,i.point(t,r),u||(e.point(t,r),u)||(o.point(t,r),u)}var t,r,i,e,o,u,c=ut(),f=ot().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ot().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(n,t){u=[n,t]}};return n.invert=function(n){var t=c.scale(),r=c.translate(),i=(n[0]-r[0])/t,e=(n[1]-r[1])/t;return(e>=.12&&e<.234&&i>=-.425&&i<-.214?f:e>=.166&&e<.234&&i>=-.214&&i<-.115?a:c).invert(n)},n.stream=function(n){return t&&r===n?t:t=ct([c.stream(r=n),f.stream(n),a.stream(n)])},n.precision=function(t){return arguments.length?(c.precision(t),f.precision(t),a.precision(t),n):c.precision()},n.scale=function(t){return arguments.length?(c.scale(t),f.scale(.35*t),a.scale(t),n.translate(c.translate())):c.scale()},n.translate=function(t){if(!arguments.length)return c.translate();var r=c.scale(),u=+t[0],p=+t[1];return i=c.translate(t).clipExtent([[u-.455*r,p-.238*r],[u+.455*r,p+.238*r]]).stream(l),e=f.translate([u-.307*r,p+.201*r]).clipExtent([[u-.425*r+sr,p+.12*r+sr],[u-.214*r-sr,p+.234*r-sr]]).stream(l),o=a.translate([u-.205*r,p+.212*r]).clipExtent([[u-.214*r+sr,p+.166*r+sr],[u-.115*r-sr,p+.234*r-sr]]).stream(l),n},n.scale(1070)}function at(n){return function(t,r){var i=Nr(t),e=Nr(r),o=n(i*e);return[o*e*Cr(t),o*Cr(r)]}}function lt(n){return function(t,r){var i=qr(t*t+r*r),e=n(i),o=Cr(e),c=Nr(e);return[xr(t*o,i*c),u(i&&r*o/i)]}}function pt(){return tt(Ni).scale(120).clipAngle(179.999)}function st(){return tt(ji).scale(480/Er).clipAngle(179.999)}function vt(n,t){return[n,Pr(zr((hr+t)/2))]}function gt(){return ht(vt)}function ht(n){var t,r=tt(n),i=r.scale,e=r.translate,o=r.clipExtent;return r.scale=function(n){return arguments.length?(i(n),t&&r.clipExtent(null),r):i()},r.translate=function(n){return arguments.length?(e(n),t&&r.clipExtent(null),r):e()},r.clipExtent=function(n){if(!arguments.length)return t?null:o();if(t=null==n){var u=gr*i(),c=e();n=[[c[0]-u,c[1]-u],[c[0]+u,c[1]+u]]}return o(n),r},r.clipExtent(null).scale(961/Er)}function dt(n){return zr((hr+n)/2)}function Et(n,t){function r(n,t){o>0?t<-hr+sr&&(t=-hr+sr):t>hr-sr&&(t=hr-sr);var r=o/Ar(dt(t),e);return[r*Cr(e*n),o-r*Nr(e*n)]}var i=Nr(n),e=n===t?Cr(n):Pr(i/Nr(t))/Pr(dt(t)/dt(n)),o=i*Ar(dt(n),e)/e;return e?(r.invert=function(n,t){var r=o-t,i=br(e)*qr(n*n+r*r);return[xr(n,r)/e,2*Mr(Ar(o/i,1/e))-hr]},r):vt}function St(){return it(Et)}function yt(n,t){return[n,t]}function mt(){return tt(yt)}function Mt(n,t){function r(n,t){var r=o-t,i=e*n;return[r*Cr(i),o-r*Nr(i)]}var i=Nr(n),e=n===t?Cr(n):(i-Nr(t))/(t-n),o=i/e+n;return mr(e)<sr?yt:(r.invert=function(n,t){var r=o-t;return[xr(n,r)/e,o-br(e)*qr(n*n+r*r)]},r)}function xt(){return it(Mt).scale(128).translate([480,280])}function Nt(n,t){var r=Nr(t),i=Nr(n)*r;return[r*Cr(n)/i,Cr(t)/i]}function jt(){return tt(Nt).scale(139).clipAngle(60)}function wt(n,t){return[Nr(t)*Cr(n),Cr(t)]}function Pt(){return tt(wt).scale(240).clipAngle(90+sr)}function At(n,t){var r=Nr(t),i=1+Nr(n)*r;return[r*Cr(n)/i,Cr(t)/i]}function Ct(){return tt(At).scale(240).clipAngle(142)}function bt(n,t){return[Pr(zr((hr+t)/2)),-n]}function qt(){var n=ht(bt),t=n.center,r=n.rotate;return n.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90])}i.prototype={constructor:i,reset:function(){this.s=this.t=0},add:function(n){e(pr,n,this.t),e(this,pr.s,this.s),this.s?this.t+=pr.t:this.s=pr.t},valueOf:function(){return this.s}};var zt,Lt,Rt,Ot,Tt,Gt,Ft,It,_t,Bt,Dt,Ut,Zt,kt,Ht,Jt,Kt,Qt,Vt,Wt,Xt,Yt,$t,nr,tr,rr,ir,er,or,ur,cr,fr,ar,lr,pr=new i,sr=1e-6,vr=1e-12,gr=Math.PI,hr=gr/2,dr=gr/4,Er=2*gr,Sr=180/gr,yr=gr/180,mr=Math.abs,Mr=Math.atan,xr=Math.atan2,Nr=Math.cos,jr=Math.ceil,wr=Math.exp,Pr=Math.log,Ar=Math.pow,Cr=Math.sin,br=Math.sign||function(n){return n>0?1:n<0?-1:0},qr=Math.sqrt,zr=Math.tan,Lr={Feature:function(n,t){a(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)a(r[i].geometry,t)}},Rr={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)n=r[i],t.point(n[0],n[1],n[2])},LineString:function(n,t){l(n.coordinates,t,0)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)l(r[i],t,0)},Polygon:function(n,t){p(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)p(r[i],t)},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)a(r[i],t)}},Or={point:f,lineStart:f,lineEnd:f,polygonStart:function(){zt.reset(),Or.lineStart=v,Or.lineEnd=g},polygonEnd:function(){var n=+zt;Lt.add(n<0?Er+n:n),this.lineStart=this.lineEnd=this.point=f},sphere:function(){Lt.add(Er)}},Tr={point:w,lineStart:A,lineEnd:C,polygonStart:function(){Tr.point=b,Tr.lineStart=q,Tr.lineEnd=z,Jt.reset(),Or.polygonStart()},polygonEnd:function(){Or.polygonEnd(),Tr.point=w,Tr.lineStart=A,Tr.lineEnd=C,zt<0?(It=-(Bt=180),_t=-(Dt=90)):Jt>sr?Dt=90:Jt<-sr&&(_t=-90),Qt[0]=It,Qt[1]=Bt}},Gr={sphere:f,point:G,lineStart:I,lineEnd:D,polygonStart:function(){Gr.lineStart=U,Gr.lineEnd=Z},polygonEnd:function(){Gr.lineStart=I,Gr.lineEnd=D}};V.invert=V;var Fr,Ir,_r,Br,Dr,Ur,Zr,kr,Hr,Jr,Kr,Qr,Vr=1e9,Wr=-Vr,Xr={sphere:f,point:f,lineStart:vn,lineEnd:f,polygonStart:f,polygonEnd:f},Yr=[null,null],$r={type:"LineString",coordinates:Yr},ni=r(),ti=r(),ri={point:f,lineStart:f,lineEnd:f,polygonStart:function(){ri.lineStart=jn,ri.lineEnd=An},polygonEnd:function(){ri.lineStart=ri.lineEnd=ri.point=f,ni.add(mr(ti)),ti.reset()},result:function(){var n=ni/2;return ni.reset(),n}},ii=1/0,ei=ii,oi=-ii,ui=oi,ci={point:Cn,lineStart:f,lineEnd:f,polygonStart:f,polygonEnd:f,result:function(){var n=[[ii,ei],[oi,ui]];return oi=ui=-(ei=ii=1/0),n}},fi=0,ai=0,li=0,pi=0,si=0,vi=0,gi=0,hi=0,di=0,Ei={point:bn,lineStart:qn,lineEnd:Rn,polygonStart:function(){Ei.lineStart=On,Ei.lineEnd=Tn},polygonEnd:function(){Ei.point=bn,Ei.lineStart=qn,Ei.lineEnd=Rn},result:function(){var n=di?[gi/di,hi/di]:vi?[pi/vi,si/vi]:li?[fi/li,ai/li]:[NaN,NaN];return fi=ai=li=pi=si=vi=gi=hi=di=0,n}},Si=r(),yi=Zn(function(){return!0},Jn,Qn,[-gr,-hr]);Xn.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var mi=16,Mi=Nr(30*yr),xi=Wn({point:function(n,t){this.stream.point(n*yr,t*yr)}}),Ni=at(function(n){return qr(2/(1+n))});Ni.invert=lt(function(n){return 2*u(n/2)});var ji=at(function(n){return(n=o(n))&&n/Cr(n)});ji.invert=lt(function(n){return n}),vt.invert=function(n,t){return[n,2*Mr(wr(t))-hr]},yt.invert=yt,Nt.invert=lt(Mr),wt.invert=lt(u),At.invert=lt(function(n){return 2+Mr(n)}),bt.invert=function(n,t){return[-t,2*Mr(wr(n))-hr]},n.geoArea=E,n.geoBounds=T,n.geoCentroid=J,n.geoCircle=en,n.geoClipExtent=sn,n.geoDistance=Sn,n.geoGraticule=Mn,n.geoInterpolate=xn,n.geoLength=En,n.geoPath=Dn,n.geoAlbers=ut,n.geoAlbersUsa=ft,n.geoAzimuthalEqualArea=pt,n.geoAzimuthalEquidistant=st,n.geoConicConformal=St,n.geoConicEqualArea=ot,n.geoConicEquidistant=xt,n.geoEquirectangular=mt,n.geoGnomonic=jt,n.geoProjection=tt,n.geoProjectionMutator=rt,n.geoMercator=gt,n.geoOrthographic=Pt,n.geoStereographic=Ct,n.geoTransverseMercator=qt,n.geoRotation=nn,n.geoStream=s,n.geoTransform=Wn,Object.defineProperty(n,"__esModule",{value:!0})});
// https://d3js.org/d3-geo/ Version 0.1.0. Copyright 2016 Mike Bostock.
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],t):t(n.d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";function r(){return new i}function i(){this.reset()}function e(n,t,r){var i=n.s=t+r,e=i-t,o=i-e;n.t=t-o+(r-e)}function o(n){return n>1?0:n<-1?hr:Math.acos(n)}function u(n){return n>1?dr:n<-1?-dr:Math.asin(n)}function c(n){return(n=br(n/2))*n}function f(){}function a(n,t){n&&Or.hasOwnProperty(n.type)&&Or[n.type](n,t)}function l(n,t,r){var i,e=-1,o=n.length-r;for(t.lineStart();++e<o;)i=n[e],t.point(i[0],i[1],i[2]);t.lineEnd()}function p(n,t){var r=-1,i=n.length;for(t.polygonStart();++r<i;)l(n[r],t,1);t.polygonEnd()}function s(n,t){n&&Rr.hasOwnProperty(n.type)?Rr[n.type](n,t):a(n,t)}function v(){Tr.point=h}function g(){d(Ot,Tt)}function h(n,t){Tr.point=d,Ot=n,Tt=t,n*=mr,t*=mr,Gt=n,Ft=jr(t=t/2+Er),It=br(t)}function d(n,t){n*=mr,t*=mr,t=t/2+Er;var r=n-Gt,i=r>=0?1:-1,e=i*r,o=jr(t),u=br(t),c=It*u,f=Ft*o+c*jr(e),a=c*i*br(e);Lt.add(Nr(a,f)),Gt=n,Ft=o,It=u}function E(n){return Rt?Rt.reset():(Rt=r(),Lt=r()),s(n,Tr),2*Rt}function S(n){return[Nr(n[1],n[0]),u(n[2])]}function y(n){var t=n[0],r=n[1],i=jr(r);return[i*jr(t),i*br(t),br(r)]}function m(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function M(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function x(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function N(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function j(n){var t=zr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function w(n,t){Qt.push(Vt=[_t=n,Dt=n]),t<Bt&&(Bt=t),t>Ut&&(Ut=t)}function P(n,t){var r=y([n*mr,t*mr]);if(Jt){var i=M(Jt,r),e=[i[1],-i[0],0],o=M(e,i);j(o),o=S(o);var u,c=n-Zt,f=c>0?1:-1,a=o[0]*yr*f,l=Mr(c)>180;l^(f*Zt<a&&a<f*n)?(u=o[1]*yr,u>Ut&&(Ut=u)):(a=(a+360)%360-180,l^(f*Zt<a&&a<f*n)?(u=-o[1]*yr,u<Bt&&(Bt=u)):(t<Bt&&(Bt=t),t>Ut&&(Ut=t))),l?n<Zt?L(_t,n)>L(_t,Dt)&&(Dt=n):L(n,Dt)>L(_t,Dt)&&(_t=n):Dt>=_t?(n<_t&&(_t=n),n>Dt&&(Dt=n)):n>Zt?L(_t,n)>L(_t,Dt)&&(Dt=n):L(n,Dt)>L(_t,Dt)&&(_t=n)}else w(n,t);Jt=r,Zt=n}function A(){Gr.point=P}function C(){Vt[0]=_t,Vt[1]=Dt,Gr.point=w,Jt=null}function b(n,t){if(Jt){var r=n-Zt;Kt.add(Mr(r)>180?r+(r>0?360:-360):r)}else kt=n,Ht=t;Tr.point(n,t),P(n,t)}function q(){Tr.lineStart()}function z(){b(kt,Ht),Tr.lineEnd(),Mr(Kt)>vr&&(_t=-(Dt=180)),Vt[0]=_t,Vt[1]=Dt,Jt=null}function L(n,t){return(t-=n)<0?t+360:t}function R(n,t){return n[0]-t[0]}function O(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}function T(n){var t,i,e,o,u,c,f;if(Kt?Kt.reset():Kt=r(),Ut=Dt=-(_t=Bt=1/0),Qt=[],s(n,Gr),i=Qt.length){for(Qt.sort(R),t=1,e=Qt[0],u=[e];t<i;++t)o=Qt[t],O(e,o[0])||O(e,o[1])?(L(e[0],o[1])>L(e[0],e[1])&&(e[1]=o[1]),L(o[0],e[1])>L(e[0],e[1])&&(e[0]=o[0])):u.push(e=o);for(c=-(1/0),i=u.length-1,t=0,e=u[i];t<=i;e=o,++t)o=u[t],(f=L(e[1],o[0]))>c&&(c=f,_t=o[0],Dt=e[1])}return Qt=Vt=null,_t===1/0||Bt===1/0?[[NaN,NaN],[NaN,NaN]]:[[_t,Bt],[Dt,Ut]]}function G(n,t){n*=mr,t*=mr;var r=jr(t);F(r*jr(n),r*br(n),br(t))}function F(n,t,r){++Wt,Yt+=(n-Yt)/Wt,$t+=(t-$t)/Wt,nr+=(r-nr)/Wt}function I(){Fr.point=_}function _(n,t){n*=mr,t*=mr;var r=jr(t);ar=r*jr(n),lr=r*br(n),pr=br(t),Fr.point=B,F(ar,lr,pr)}function B(n,t){n*=mr,t*=mr;var r=jr(t),i=r*jr(n),e=r*br(n),o=br(t),u=Nr(zr((u=lr*o-pr*e)*u+(u=pr*i-ar*o)*u+(u=ar*e-lr*i)*u),ar*i+lr*e+pr*o);Xt+=u,tr+=u*(ar+(ar=i)),rr+=u*(lr+(lr=e)),ir+=u*(pr+(pr=o)),F(ar,lr,pr)}function D(){Fr.point=G}function U(){Fr.point=k}function Z(){H(cr,fr),Fr.point=G}function k(n,t){cr=n,fr=t,n*=mr,t*=mr,Fr.point=H;var r=jr(t);ar=r*jr(n),lr=r*br(n),pr=br(t),F(ar,lr,pr)}function H(n,t){n*=mr,t*=mr;var r=jr(t),i=r*jr(n),e=r*br(n),u=br(t),c=lr*u-pr*e,f=pr*i-ar*u,a=ar*e-lr*i,l=zr(c*c+f*f+a*a),p=ar*i+lr*e+pr*u,s=l&&-o(p)/l,v=Nr(l,p);er+=s*c,or+=s*f,ur+=s*a,Xt+=v,tr+=v*(ar+(ar=i)),rr+=v*(lr+(lr=e)),ir+=v*(pr+(pr=u)),F(ar,lr,pr)}function J(n){Wt=Xt=Yt=$t=nr=tr=rr=ir=er=or=ur=0,s(n,Fr);var t=er,r=or,i=ur,e=t*t+r*r+i*i;return e<gr&&(t=tr,r=rr,i=ir,Xt<vr&&(t=Yt,r=$t,i=nr),e=t*t+r*r+i*i,e<gr)?[NaN,NaN]:[Nr(r,t)*yr,u(i/zr(e))*yr]}function K(n){return function(){return n}}function Q(n,t){function r(r,i){return r=n(r,i),t(r[0],r[1])}return n.invert&&t.invert&&(r.invert=function(r,i){return r=t.invert(r,i),r&&n.invert(r[0],r[1])}),r}function V(n,t){return[n>hr?n-Sr:n<-hr?n+Sr:n,t]}function W(n,t,r){return(n%=Sr)?t||r?Q(Y(n),$(t,r)):Y(n):t||r?$(t,r):V}function X(n){return function(t,r){return t+=n,[t>hr?t-Sr:t<-hr?t+Sr:t,r]}}function Y(n){var t=X(n);return t.invert=X(-n),t}function $(n,t){function r(n,t){var r=jr(t),f=jr(n)*r,a=br(n)*r,l=br(t),p=l*i+f*e;return[Nr(a*o-p*c,f*i-l*e),u(p*o+a*c)]}var i=jr(n),e=br(n),o=jr(t),c=br(t);return r.invert=function(n,t){var r=jr(t),f=jr(n)*r,a=br(n)*r,l=br(t),p=l*o-a*c;return[Nr(a*o+l*c,f*i+p*e),u(p*i-f*e)]},r}function nn(n){function t(t){return t=n(t[0]*mr,t[1]*mr),t[0]*=yr,t[1]*=yr,t}return n=W(n[0]*mr,n[1]*mr,n.length>2?n[2]*mr:0),t.invert=function(t){return t=n.invert(t[0]*mr,t[1]*mr),t[0]*=yr,t[1]*=yr,t},t}function tn(n,t,r,i,e,o){if(r){var u=jr(t),c=br(t),f=i*r;null==e?(e=t+i*Sr,o=t-f/2):(e=rn(u,e),o=rn(u,o),(i>0?e<o:e>o)&&(e+=i*Sr));for(var a,l=e;i>0?l>o:l<o;l-=f)a=S([u,-c*jr(l),-c*br(l)]),n.point(a[0],a[1])}}function rn(n,t){t=y(t),t[0]-=n,j(t);var r=o(-t[1]);return((-t[2]<0?-r:r)+Sr-vr)%Sr}function en(){function n(n,t){r.push(n=i(n,t)),n[0]*=yr,n[1]*=yr}function t(){var n=e.apply(this,arguments),t=o.apply(this,arguments)*mr,f=u.apply(this,arguments)*mr;return r=[],i=W(-n[0]*mr,-n[1]*mr,0).invert,tn(c,t,f,1),n={type:"Polygon",coordinates:[r]},r=i=null,n}var r,i,e=K([0,0]),o=K(90),u=K(6),c={point:n};return t.center=function(n){return arguments.length?(e="function"==typeof n?n:K([+n[0],+n[1]]),t):e},t.radius=function(n){return arguments.length?(o="function"==typeof n?n:K(+n),t):o},t.precision=function(n){return arguments.length?(u="function"==typeof n?n:K(+n),t):u},t}function on(){var n,t=[];return{point:function(t,r){n.push([t,r])},lineStart:function(){t.push(n=[])},lineEnd:f,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}}function un(n,t,r,i,e,o){var u,c=n[0],f=n[1],a=t[0],l=t[1],p=0,s=1,v=a-c,g=l-f;if(u=r-c,v||!(u>0)){if(u/=v,v<0){if(u<p)return;u<s&&(s=u)}else if(v>0){if(u>s)return;u>p&&(p=u)}if(u=e-c,v||!(u<0)){if(u/=v,v<0){if(u>s)return;u>p&&(p=u)}else if(v>0){if(u<p)return;u<s&&(s=u)}if(u=i-f,g||!(u>0)){if(u/=g,g<0){if(u<p)return;u<s&&(s=u)}else if(g>0){if(u>s)return;u>p&&(p=u)}if(u=o-f,g||!(u<0)){if(u/=g,g<0){if(u>s)return;u>p&&(p=u)}else if(g>0){if(u<p)return;u<s&&(s=u)}return p>0&&(n[0]=c+p*v,n[1]=f+p*g),s<1&&(t[0]=c+s*v,t[1]=f+s*g),!0}}}}}function cn(n,t){return Mr(n[0]-t[0])<vr&&Mr(n[1]-t[1])<vr}function fn(n,t,r,i){this.x=n,this.z=t,this.o=r,this.e=i,this.v=!1,this.n=this.p=null}function an(n,t,r,i,e){var o,u,c=[],f=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,r,i=n[0],u=n[t];if(cn(i,u)){for(e.lineStart(),o=0;o<t;++o)e.point((i=n[o])[0],i[1]);return void e.lineEnd()}c.push(r=new fn(i,n,null,(!0))),f.push(r.o=new fn(i,null,r,(!1))),c.push(r=new fn(u,n,null,(!1))),f.push(r.o=new fn(u,null,r,(!0)))}}),c.length){for(f.sort(t),ln(c),ln(f),o=0,u=f.length;o<u;++o)f[o].e=r=!r;for(var a,l,p=c[0];;){for(var s=p,v=!0;s.v;)if((s=s.n)===p)return;a=s.z,e.lineStart();do{if(s.v=s.o.v=!0,s.e){if(v)for(o=0,u=a.length;o<u;++o)e.point((l=a[o])[0],l[1]);else i(s.x,s.n.x,1,e);s=s.n}else{if(v)for(a=s.p.z,o=a.length-1;o>=0;--o)e.point((l=a[o])[0],l[1]);else i(s.x,s.p.x,-1,e);s=s.p}s=s.o,a=s.z,v=!v}while(!s.v);e.lineEnd()}}}function ln(n){if(t=n.length){for(var t,r,i=0,e=n[0];++i<t;)e.n=r=n[i],r.p=e,e=r;e.n=r=n[0],r.p=e}}function pn(n,r,i,e){function o(t,o){return n<=t&&t<=i&&r<=o&&o<=e}function u(t,o,u,f){var l=0,p=0;if(null==t||(l=c(t,u))!==(p=c(o,u))||a(t,o)<0^u>0){do f.point(0===l||3===l?n:i,l>1?e:r);while((l=(l+u+4)%4)!==p)}else f.point(o[0],o[1])}function c(t,e){return Mr(t[0]-n)<vr?e>0?0:3:Mr(t[0]-i)<vr?e>0?2:1:Mr(t[1]-r)<vr?e>0?1:0:e>0?3:2}function f(n,t){return a(n.x,t.x)}function a(n,t){var r=c(n,1),i=c(t,1);return r!==i?r-i:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(c){function a(n,t){o(n,t)&&A.point(n,t)}function l(){for(var t=0,r=0,i=E.length;r<i;++r)for(var o,u,c=E[r],f=1,a=c.length,l=c[0],p=l[0],s=l[1];f<a;++f)o=p,u=s,l=c[f],p=l[0],s=l[1],u<=e?s>e&&(p-o)*(e-u)>(s-u)*(n-o)&&++t:s<=e&&(p-o)*(e-u)<(s-u)*(n-o)&&--t;return t}function p(){A=C,d=[],E=[],P=!0}function s(){var n=l(),r=P&&n,i=(d=t.merge(d)).length;(r||i)&&(c.polygonStart(),r&&(c.lineStart(),u(null,null,1,c),c.lineEnd()),i&&an(d,f,n,u,c),c.polygonEnd()),A=c,d=E=S=null}function v(){b.point=h,E&&E.push(S=[]),w=!0,j=!1,x=N=NaN}function g(){d&&(h(y,m),M&&j&&C.rejoin(),d.push(C.result())),b.point=a,j&&A.lineEnd()}function h(t,u){var c=o(t,u);if(E&&S.push([t,u]),w)y=t,m=u,M=c,w=!1,c&&(A.lineStart(),A.point(t,u));else if(c&&j)A.point(t,u);else{var f=[x=Math.max(Xr,Math.min(Wr,x)),N=Math.max(Xr,Math.min(Wr,N))],a=[t=Math.max(Xr,Math.min(Wr,t)),u=Math.max(Xr,Math.min(Wr,u))];un(f,a,n,r,i,e)?(j||(A.lineStart(),A.point(f[0],f[1])),A.point(a[0],a[1]),c||A.lineEnd(),P=!1):c&&(A.lineStart(),A.point(t,u),P=!1)}x=t,N=u,j=c}var d,E,S,y,m,M,x,N,j,w,P,A=c,C=on(),b={point:a,lineStart:v,lineEnd:g,polygonStart:p,polygonEnd:s};return b}}function sn(){var n,t,r,i=0,e=0,o=960,u=500;return r={stream:function(r){return n&&t===r?n:n=pn(i,e,o,u)(t=r)},extent:function(c){return arguments.length?(i=+c[0][0],e=+c[0][1],o=+c[1][0],u=+c[1][1],n=t=null,r):[[i,e],[o,u]]}}}function vn(){Yr.point=hn,Yr.lineEnd=gn}function gn(){Yr.point=Yr.lineEnd=f}function hn(n,t){n*=mr,t*=mr,_r=n,Br=br(t),Dr=jr(t),Yr.point=dn}function dn(n,t){n*=mr,t*=mr;var r=br(t),i=jr(t),e=Mr(n-_r),o=jr(e),u=br(e),c=i*u,f=Dr*r-Br*i*o,a=Br*r+Dr*i*o;Ir.add(Nr(zr(c*c+f*f),a)),_r=n,Br=r,Dr=i}function En(n){return Ir?Ir.reset():Ir=r(),s(n,Yr),+Ir}function Sn(n,t){return $r[0]=n,$r[1]=t,En(ni)}function yn(n,r,i){var e=t.range(n,r-vr,i).concat(r);return function(n){return e.map(function(t){return[n,t]})}}function mn(n,r,i){var e=t.range(n,r-vr,i).concat(r);return function(n){return e.map(function(t){return[t,n]})}}function Mn(){function n(){return{type:"MultiLineString",coordinates:r()}}function r(){return t.range(wr(u/E)*E,o,E).map(v).concat(t.range(wr(l/S)*S,a,S).map(g)).concat(t.range(wr(e/h)*h,i,h).filter(function(n){return Mr(n%E)>vr}).map(p)).concat(t.range(wr(f/d)*d,c,d).filter(function(n){return Mr(n%S)>vr}).map(s))}var i,e,o,u,c,f,a,l,p,s,v,g,h=10,d=h,E=90,S=360,y=2.5;return n.lines=function(){return r().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[v(u).concat(g(a).slice(1),v(o).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.extentMajor(t).extentMinor(t):n.extentMinor()},n.extentMajor=function(t){return arguments.length?(u=+t[0][0],o=+t[1][0],l=+t[0][1],a=+t[1][1],u>o&&(t=u,u=o,o=t),l>a&&(t=l,l=a,a=t),n.precision(y)):[[u,l],[o,a]]},n.extentMinor=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],f=+t[0][1],c=+t[1][1],e>i&&(t=e,e=i,i=t),f>c&&(t=f,f=c,c=t),n.precision(y)):[[e,f],[i,c]]},n.step=function(t){return arguments.length?n.stepMajor(t).stepMinor(t):n.stepMinor()},n.stepMajor=function(t){return arguments.length?(E=+t[0],S=+t[1],n):[E,S]},n.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],n):[h,d]},n.precision=function(t){return arguments.length?(y=+t,p=yn(f,c,90),s=mn(e,i,y),v=yn(l,a,90),g=mn(u,o,y),n):y},n.extentMajor([[-180,-90+vr],[180,90-vr]]).extentMinor([[-180,-80-vr],[180,80+vr]])}function xn(n,t){var r=n[0]*mr,i=n[1]*mr,e=t[0]*mr,o=t[1]*mr,f=jr(i),a=br(i),l=jr(o),p=br(o),s=f*jr(r),v=f*br(r),g=l*jr(e),h=l*br(e),d=2*u(zr(c(o-i)+f*l*c(e-r))),E=br(d),S=d?function(n){var t=br(n*=d)/E,r=br(d-n)/E,i=r*s+t*g,e=r*v+t*h,o=r*a+t*p;return[Nr(e,i)*yr,Nr(o,zr(i*i+e*e))*yr]}:function(){return[r*yr,i*yr]};return S.distance=d,S}function Nn(n){return n}function jn(){ii.point=wn}function wn(n,t){ii.point=Pn,Ur=kr=n,Zr=Hr=t}function Pn(n,t){ri.add(Hr*n-kr*t),kr=n,Hr=t}function An(){Pn(Ur,Zr)}function Cn(n,t){n<ei&&(ei=n),n>ui&&(ui=n),t<oi&&(oi=t),t>ci&&(ci=t)}function bn(n,t){ai+=n,li+=t,++pi}function qn(){Si.point=zn}function zn(n,t){Si.point=Ln,bn(Qr=n,Vr=t)}function Ln(n,t){var r=n-Qr,i=t-Vr,e=zr(r*r+i*i);si+=e*(Qr+n)/2,vi+=e*(Vr+t)/2,gi+=e,bn(Qr=n,Vr=t)}function Rn(){Si.point=bn}function On(){Si.point=Gn}function Tn(){Fn(Jr,Kr)}function Gn(n,t){Si.point=Fn,bn(Jr=Qr=n,Kr=Vr=t)}function Fn(n,t){var r=n-Qr,i=t-Vr,e=zr(r*r+i*i);si+=e*(Qr+n)/2,vi+=e*(Vr+t)/2,gi+=e,e=Vr*n-Qr*t,hi+=e*(Qr+n),di+=e*(Vr+t),Ei+=3*e,bn(Qr=n,Vr=t)}function In(n){function t(t,r){n.moveTo(t+u,r),n.arc(t,r,u,0,Sr)}function r(t,r){n.moveTo(t,r),c.point=i}function i(t,r){n.lineTo(t,r)}function e(){c.point=t}function o(){n.closePath()}var u=4.5,c={point:t,lineStart:function(){c.point=r},lineEnd:e,polygonStart:function(){c.lineEnd=o},polygonEnd:function(){c.lineEnd=e,c.point=t},pointRadius:function(n){return u=n,c},result:f};return c}function _n(){function n(n,t){c.push("M",n,",",t,u)}function t(n,t){c.push("M",n,",",t),f.point=r}function r(n,t){c.push("L",n,",",t)}function i(){f.point=t}function e(){f.point=n}function o(){c.push("Z")}var u=Bn(4.5),c=[],f={point:n,lineStart:i,lineEnd:e,polygonStart:function(){f.lineEnd=o},polygonEnd:function(){f.lineEnd=e,f.point=n},pointRadius:function(n){return u=Bn(n),f},result:function(){if(c.length){var n=c.join("");return c=[],n}}};return f}function Bn(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Dn(){function n(n){return n&&("function"==typeof o&&e.pointRadius(+o.apply(this,arguments)),s(n,r(e))),e.result()}var t,r,i,e,o=4.5;return n.area=function(n){return s(n,r(ii)),ii.result()},n.bounds=function(n){return s(n,r(fi)),fi.result()},n.centroid=function(n){return s(n,r(Si)),Si.result()},n.projection=function(i){return arguments.length?(r=null==(t=i)?Nn:i.stream,n):t},n.context=function(t){return arguments.length?(e=null==(i=t)?new _n:new In(t),"function"!=typeof o&&e.pointRadius(o),n):i},n.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(e.pointRadius(+t),+t),n):o},n.projection(null).context(null)}function Un(n,t){for(var r=t[0],i=t[1],e=[br(r),-jr(r),0],o=0,c=0,f=0,a=n.length;f<a;++f)if(p=(l=n[f]).length)for(var l,p,s=l[p-1],v=s[0],g=s[1]/2+Er,h=br(g),d=jr(g),E=0;E<p;++E,v=m,h=N,d=w,s=S){var S=l[E],m=S[0],x=S[1]/2+Er,N=br(x),w=jr(x),P=m-v,A=P>=0?1:-1,C=A*P,b=C>hr,q=h*N;if(yi.add(Nr(q*A*br(C),d*w+q*jr(C))),o+=b?P+A*Sr:P,b^v>=r^m>=r){var z=M(y(s),y(S));j(z);var L=M(e,z);j(L);var R=(b^P>=0?-1:1)*u(L[2]);(i>R||i===R&&(z[0]||z[1]))&&(c+=b^P>=0?1:-1)}}var O=(o<-vr||o<vr&&yi<-vr)^1&c;return yi.reset(),O}function Zn(n,r,i,e){return function(o,u){function c(t,r){var i=o(t,r);n(t=i[0],r=i[1])&&u.point(t,r)}function f(n,t){var r=o(n,t);E.point(r[0],r[1])}function a(){x.point=f,E.lineStart()}function l(){x.point=c,E.lineEnd()}function p(n,t){d.push([n,t]);var r=o(n,t);m.point(r[0],r[1])}function s(){m.lineStart(),d=[]}function v(){p(d[0][0],d[0][1]),m.lineEnd();var n,t,r,i,e=m.clean(),o=y.result(),c=o.length;if(d.pop(),g.push(d),d=null,c)if(1&e){if(r=o[0],(t=r.length-1)>0){for(M||(u.polygonStart(),M=!0),u.lineStart(),n=0;n<t;++n)u.point((i=r[n])[0],i[1]);u.lineEnd()}}else c>1&&2&e&&o.push(o.pop().concat(o.shift())),h.push(o.filter(kn))}var g,h,d,E=r(u),S=o.invert(e[0],e[1]),y=on(),m=r(y),M=!1,x={point:c,lineStart:a,lineEnd:l,polygonStart:function(){x.point=p,x.lineStart=s,x.lineEnd=v,h=[],g=[]},polygonEnd:function(){x.point=c,x.lineStart=a,x.lineEnd=l,h=t.merge(h);var n=Un(g,S);h.length?(M||(u.polygonStart(),M=!0),an(h,Hn,n,i,u)):n&&(M||(u.polygonStart(),M=!0),u.lineStart(),i(null,null,1,u),u.lineEnd()),M&&(u.polygonEnd(),M=!1),h=g=null},sphere:function(){u.polygonStart(),u.lineStart(),i(null,null,1,u),u.lineEnd(),u.polygonEnd()}};return x}}function kn(n){return n.length>1}function Hn(n,t){return((n=n.x)[0]<0?n[1]-dr-vr:dr-n[1])-((t=t.x)[0]<0?t[1]-dr-vr:dr-t[1])}function Jn(n){var t,r=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var c=o>0?hr:-hr,f=Mr(o-r);Mr(f-hr)<vr?(n.point(r,i=(i+u)/2>0?dr:-dr),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),n.point(o,i),t=0):e!==c&&f>=hr&&(Mr(r-e)<vr&&(r-=e*vr),Mr(o-c)<vr&&(o-=c*vr),i=Kn(r,i,o,u),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),t=0),n.point(r=o,i=u),e=c},lineEnd:function(){n.lineEnd(),r=i=NaN},clean:function(){return 2-t}}}function Kn(n,t,r,i){var e,o,u=br(n-r);return Mr(u)>vr?xr((br(t)*(o=jr(i))*br(r)-br(i)*(e=jr(t))*br(n))/(e*o*u)):(t+i)/2}function Qn(n,t,r,i){var e;if(null==n)e=r*dr,i.point(-hr,e),i.point(0,e),i.point(hr,e),i.point(hr,0),i.point(hr,-e),i.point(0,-e),i.point(-hr,-e),i.point(-hr,0),i.point(-hr,e);else if(Mr(n[0]-t[0])>vr){var o=n[0]<t[0]?hr:-hr;e=r*o/2,i.point(-o,e),i.point(0,e),i.point(o,e)}else i.point(t[0],t[1])}function Vn(n,t){function r(r,i,e,o){tn(o,n,t,e,r,i)}function i(n,t){return jr(n)*jr(t)>c}function e(n){var t,r,e,c,l;return{lineStart:function(){c=e=!1,l=1},point:function(p,s){var v,g=[p,s],h=i(p,s),d=f?h?0:u(p,s):h?u(p+(p<0?hr:-hr),s):0;if(!t&&(c=e=h)&&n.lineStart(),h!==e&&(v=o(t,g),(cn(t,v)||cn(g,v))&&(g[0]+=vr,g[1]+=vr,h=i(g[0],g[1]))),h!==e)l=0,h?(n.lineStart(),v=o(g,t),n.point(v[0],v[1])):(v=o(t,g),n.point(v[0],v[1]),n.lineEnd()),t=v;else if(a&&t&&f^h){var E;d&r||!(E=o(g,t,!0))||(l=0,f?(n.lineStart(),n.point(E[0][0],E[0][1]),n.point(E[1][0],E[1][1]),n.lineEnd()):(n.point(E[1][0],E[1][1]),n.lineEnd(),n.lineStart(),n.point(E[0][0],E[0][1])))}!h||t&&cn(t,g)||n.point(g[0],g[1]),t=g,e=h,r=d},lineEnd:function(){e&&n.lineEnd(),t=null},clean:function(){return l|(c&&e)<<1}}}function o(n,t,r){var i=y(n),e=y(t),o=[1,0,0],u=M(i,e),f=m(u,u),a=u[0],l=f-a*a;if(!l)return!r&&n;var p=c*f/l,s=-c*a/l,v=M(o,u),g=N(o,p),h=N(u,s);x(g,h);var d=v,E=m(g,d),j=m(d,d),w=E*E-j*(m(g,g)-1);if(!(w<0)){var P=zr(w),A=N(d,(-E-P)/j);if(x(A,g),A=S(A),!r)return A;var C,b=n[0],q=t[0],z=n[1],L=t[1];q<b&&(C=b,b=q,q=C);var R=q-b,O=Mr(R-hr)<vr,T=O||R<vr;if(!O&&L<z&&(C=z,z=L,L=C),T?O?z+L>0^A[1]<(Mr(A[0]-b)<vr?z:L):z<=A[1]&&A[1]<=L:R>hr^(b<=A[0]&&A[0]<=q)){var G=N(d,(-E+P)/j);return x(G,g),[A,S(G)]}}}function u(t,r){var i=f?n:hr-n,e=0;return t<-i?e|=1:t>i&&(e|=2),r<-i?e|=4:r>i&&(e|=8),e}var c=jr(n),f=c>0,a=Mr(c)>vr;return Zn(i,e,r,f?[0,-n]:[-hr,n-hr])}function Wn(n){return{stream:Xn(n)}}function Xn(n){function t(){}var r=t.prototype=Object.create(Yn.prototype);for(var i in n)r[i]=n[i];return function(n){var r=new t;return r.stream=n,r}}function Yn(){}function $n(n,t){return+t?tt(n,t):nt(n)}function nt(n){return Xn({point:function(t,r){t=n(t,r),this.stream.point(t[0],t[1])}})}function tt(n,t){function r(i,e,o,c,f,a,l,p,s,v,g,h,d,E){var S=l-i,y=p-e,m=S*S+y*y;if(m>4*t&&d--){var M=c+v,x=f+g,N=a+h,j=zr(M*M+x*x+N*N),w=u(N/=j),P=Mr(Mr(N)-1)<vr||Mr(o-s)<vr?(o+s)/2:Nr(x,M),A=n(P,w),C=A[0],b=A[1],q=C-i,z=b-e,L=y*q-S*z;(L*L/m>t||Mr((S*q+y*z)/m-.5)>.3||c*v+f*g+a*h<xi)&&(r(i,e,o,c,f,a,C,b,P,M/=j,x/=j,N,d,E),E.point(C,b),r(C,b,P,M,x,N,l,p,s,v,g,h,d,E))}}return function(t){function i(r,i){r=n(r,i),t.point(r[0],r[1])}function e(){E=NaN,N.point=o,t.lineStart()}function o(i,e){var o=y([i,e]),u=n(i,e);r(E,S,d,m,M,x,E=u[0],S=u[1],d=i,m=o[0],M=o[1],x=o[2],Mi,t),t.point(E,S)}function u(){N.point=i,t.lineEnd()}function c(){e(),N.point=f,N.lineEnd=a}function f(n,t){o(l=n,t),p=E,s=S,v=m,g=M,h=x,N.point=o}function a(){r(E,S,d,m,M,x,p,s,l,v,g,h,Mi,t),N.lineEnd=u,u()}var l,p,s,v,g,h,d,E,S,m,M,x,N={point:i,lineStart:e,lineEnd:u,polygonStart:function(){t.polygonStart(),N.lineStart=c},polygonEnd:function(){t.polygonEnd(),N.lineStart=e}};return N}}function rt(n){return it(function(){return n})()}function it(n){function t(n){return n=l(n[0]*mr,n[1]*mr),[n[0]*d+c,f-n[1]*d]}function r(n){return n=l.invert((n[0]-c)/d,(f-n[1])/d),n&&[n[0]*yr,n[1]*yr]}function i(n,t){return n=u(n,t),[n[0]*d+c,f-n[1]*d]}function e(){l=Q(a=W(M,x,N),u);var n=u(y,m);return c=E-n[0]*d,f=S+n[1]*d,o()}function o(){return g=h=null,t}var u,c,f,a,l,p,s,v,g,h,d=150,E=480,S=250,y=0,m=0,M=0,x=0,N=0,j=null,w=mi,P=null,A=Nn,C=.5,b=$n(i,C);return t.stream=function(n){return g&&h===n?g:g=Ni(w(a,b(A(h=n))))},t.clipAngle=function(n){return arguments.length?(w=+n?Vn(j=n*mr,6*mr):(j=null,mi),o()):j*yr},t.clipExtent=function(n){return arguments.length?(A=null==n?(P=p=s=v=null,Nn):pn(P=+n[0][0],p=+n[0][1],s=+n[1][0],v=+n[1][1]),o()):null==P?null:[[P,p],[s,v]]},t.scale=function(n){return arguments.length?(d=+n,e()):d},t.translate=function(n){return arguments.length?(E=+n[0],S=+n[1],e()):[E,S]},t.center=function(n){return arguments.length?(y=n[0]%360*mr,m=n[1]%360*mr,e()):[y*yr,m*yr]},t.rotate=function(n){return arguments.length?(M=n[0]%360*mr,x=n[1]%360*mr,N=n.length>2?n[2]%360*mr:0,e()):[M*yr,x*yr,N*yr]},t.precision=function(n){return arguments.length?(b=$n(i,C=n*n),o()):zr(C)},function(){return u=n.apply(this,arguments),t.invert=u.invert&&r,e()}}function et(n){var t=0,r=hr/3,i=it(n),e=i(t,r);return e.parallels=function(n){return arguments.length?i(t=n[0]*mr,r=n[1]*mr):[t*yr,r*yr]},e}function ot(n,t){function r(n,t){var r=zr(o-2*e*br(t))/e;return[r*br(n*=e),c-r*jr(n)]}var i=br(n),e=(i+br(t))/2,o=1+i*(2*e-i),c=zr(o)/e;return r.invert=function(n,t){var r=c-t;return[Nr(n,r)/e,u((o-(n*n+r*r)*e*e)/(2*e))]},r}function ut(){return et(ot).scale(151).translate([480,347])}function ct(){return ut().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function ft(n){var t=n.length;return{point:function(r,i){for(var e=-1;++e<t;)n[e].point(r,i)},sphere:function(){for(var r=-1;++r<t;)n[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)n[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)n[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)n[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)n[r].polygonEnd()}}}function at(){function n(n){var t=n[0],r=n[1];return u=null,i.point(t,r),u||(e.point(t,r),u)||(o.point(t,r),u)}var t,r,i,e,o,u,c=ct(),f=ut().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ut().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(n,t){u=[n,t]}};return n.invert=function(n){var t=c.scale(),r=c.translate(),i=(n[0]-r[0])/t,e=(n[1]-r[1])/t;return(e>=.12&&e<.234&&i>=-.425&&i<-.214?f:e>=.166&&e<.234&&i>=-.214&&i<-.115?a:c).invert(n)},n.stream=function(n){return t&&r===n?t:t=ft([c.stream(r=n),f.stream(n),a.stream(n)])},n.precision=function(t){return arguments.length?(c.precision(t),f.precision(t),a.precision(t),n):c.precision()},n.scale=function(t){return arguments.length?(c.scale(t),f.scale(.35*t),a.scale(t),n.translate(c.translate())):c.scale()},n.translate=function(t){if(!arguments.length)return c.translate();var r=c.scale(),u=+t[0],p=+t[1];return i=c.translate(t).clipExtent([[u-.455*r,p-.238*r],[u+.455*r,p+.238*r]]).stream(l),e=f.translate([u-.307*r,p+.201*r]).clipExtent([[u-.425*r+vr,p+.12*r+vr],[u-.214*r-vr,p+.234*r-vr]]).stream(l),o=a.translate([u-.205*r,p+.212*r]).clipExtent([[u-.214*r+vr,p+.166*r+vr],[u-.115*r-vr,p+.234*r-vr]]).stream(l),n},n.scale(1070)}function lt(n){return function(t,r){var i=jr(t),e=jr(r),o=n(i*e);return[o*e*br(t),o*br(r)]}}function pt(n){return function(t,r){var i=zr(t*t+r*r),e=n(i),o=br(e),c=jr(e);return[Nr(t*o,i*c),u(i&&r*o/i)]}}function st(){return rt(ji).scale(120).clipAngle(179.999)}function vt(){return rt(wi).scale(480/Sr).clipAngle(179.999)}function gt(n,t){return[n,Ar(Lr((dr+t)/2))]}function ht(){return dt(gt)}function dt(n){var t,r=rt(n),i=r.scale,e=r.translate,o=r.clipExtent;return r.scale=function(n){return arguments.length?(i(n),t&&r.clipExtent(null),r):i()},r.translate=function(n){return arguments.length?(e(n),t&&r.clipExtent(null),r):e()},r.clipExtent=function(n){if(!arguments.length)return t?null:o();if(t=null==n){var u=hr*i(),c=e();n=[[c[0]-u,c[1]-u],[c[0]+u,c[1]+u]]}return o(n),r},r.clipExtent(null).scale(961/Sr)}function Et(n){return Lr((dr+n)/2)}function St(n,t){function r(n,t){o>0?t<-dr+vr&&(t=-dr+vr):t>dr-vr&&(t=dr-vr);var r=o/Cr(Et(t),e);return[r*br(e*n),o-r*jr(e*n)]}var i=jr(n),e=n===t?br(n):Ar(i/jr(t))/Ar(Et(t)/Et(n)),o=i*Cr(Et(n),e)/e;return e?(r.invert=function(n,t){var r=o-t,i=qr(e)*zr(n*n+r*r);return[Nr(n,r)/e,2*xr(Cr(o/i,1/e))-dr]},r):gt}function yt(){return et(St)}function mt(n,t){return[n,t]}function Mt(){return rt(mt).scale(480/hr)}function xt(n,t){function r(n,t){var r=o-t,i=e*n;return[r*br(i),o-r*jr(i)]}var i=jr(n),e=n===t?br(n):(i-jr(t))/(t-n),o=i/e+n;return Mr(e)<vr?mt:(r.invert=function(n,t){var r=o-t;return[Nr(n,r)/e,o-qr(e)*zr(n*n+r*r)]},r)}function Nt(){return et(xt).scale(128).translate([480,280])}function jt(n,t){var r=jr(t),i=jr(n)*r;return[r*br(n)/i,br(t)/i]}function wt(){return rt(jt).scale(139).clipAngle(60)}function Pt(n,t){return[jr(t)*br(n),br(t)]}function At(){return rt(Pt).scale(240).clipAngle(90+vr)}function Ct(n,t){var r=jr(t),i=1+jr(n)*r;return[r*br(n)/i,br(t)/i]}function bt(){return rt(Ct).scale(240).clipAngle(142)}function qt(n,t){return[Ar(Lr((dr+t)/2)),-n]}function zt(){var n=dt(qt),t=n.center,r=n.rotate;return n.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90])}i.prototype={constructor:i,reset:function(){this.s=this.t=0},add:function(n){e(sr,n,this.t),e(this,sr.s,this.s),this.s?this.t+=sr.t:this.s=sr.t},valueOf:function(){return this.s}};var Lt,Rt,Ot,Tt,Gt,Ft,It,_t,Bt,Dt,Ut,Zt,kt,Ht,Jt,Kt,Qt,Vt,Wt,Xt,Yt,$t,nr,tr,rr,ir,er,or,ur,cr,fr,ar,lr,pr,sr=new i,vr=1e-6,gr=1e-12,hr=Math.PI,dr=hr/2,Er=hr/4,Sr=2*hr,yr=180/hr,mr=hr/180,Mr=Math.abs,xr=Math.atan,Nr=Math.atan2,jr=Math.cos,wr=Math.ceil,Pr=Math.exp,Ar=Math.log,Cr=Math.pow,br=Math.sin,qr=Math.sign||function(n){return n>0?1:n<0?-1:0},zr=Math.sqrt,Lr=Math.tan,Rr={Feature:function(n,t){a(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)a(r[i].geometry,t)}},Or={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)n=r[i],t.point(n[0],n[1],n[2])},LineString:function(n,t){l(n.coordinates,t,0)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)l(r[i],t,0)},Polygon:function(n,t){p(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)p(r[i],t)},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)a(r[i],t)}},Tr={point:f,lineStart:f,lineEnd:f,polygonStart:function(){Lt.reset(),Tr.lineStart=v,Tr.lineEnd=g},polygonEnd:function(){var n=+Lt;Rt.add(n<0?Sr+n:n),this.lineStart=this.lineEnd=this.point=f},sphere:function(){Rt.add(Sr)}},Gr={point:w,lineStart:A,lineEnd:C,polygonStart:function(){Gr.point=b,Gr.lineStart=q,Gr.lineEnd=z,Kt.reset(),Tr.polygonStart()},polygonEnd:function(){Tr.polygonEnd(),Gr.point=w,Gr.lineStart=A,Gr.lineEnd=C,Lt<0?(_t=-(Dt=180),Bt=-(Ut=90)):Kt>vr?Ut=90:Kt<-vr&&(Bt=-90),Vt[0]=_t,Vt[1]=Dt}},Fr={sphere:f,point:G,lineStart:I,lineEnd:D,polygonStart:function(){Fr.lineStart=U,Fr.lineEnd=Z},polygonEnd:function(){Fr.lineStart=I,Fr.lineEnd=D}};V.invert=V;var Ir,_r,Br,Dr,Ur,Zr,kr,Hr,Jr,Kr,Qr,Vr,Wr=1e9,Xr=-Wr,Yr={sphere:f,point:f,lineStart:vn,lineEnd:f,polygonStart:f,polygonEnd:f},$r=[null,null],ni={type:"LineString",coordinates:$r},ti=r(),ri=r(),ii={point:f,lineStart:f,lineEnd:f,polygonStart:function(){ii.lineStart=jn,ii.lineEnd=An},polygonEnd:function(){ii.lineStart=ii.lineEnd=ii.point=f,ti.add(Mr(ri)),ri.reset()},result:function(){var n=ti/2;return ti.reset(),n}},ei=1/0,oi=ei,ui=-ei,ci=ui,fi={point:Cn,lineStart:f,lineEnd:f,polygonStart:f,polygonEnd:f,result:function(){var n=[[ei,oi],[ui,ci]];return ui=ci=-(oi=ei=1/0),n}},ai=0,li=0,pi=0,si=0,vi=0,gi=0,hi=0,di=0,Ei=0,Si={point:bn,lineStart:qn,lineEnd:Rn,polygonStart:function(){Si.lineStart=On,Si.lineEnd=Tn},polygonEnd:function(){Si.point=bn,Si.lineStart=qn,Si.lineEnd=Rn},result:function(){var n=Ei?[hi/Ei,di/Ei]:gi?[si/gi,vi/gi]:pi?[ai/pi,li/pi]:[NaN,NaN];return ai=li=pi=si=vi=gi=hi=di=Ei=0,n}},yi=r(),mi=Zn(function(){return!0},Jn,Qn,[-hr,-dr]);Yn.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Mi=16,xi=jr(30*mr),Ni=Xn({point:function(n,t){this.stream.point(n*mr,t*mr)}}),ji=lt(function(n){return zr(2/(1+n))});ji.invert=pt(function(n){return 2*u(n/2)});var wi=lt(function(n){return(n=o(n))&&n/br(n)});wi.invert=pt(function(n){return n}),gt.invert=function(n,t){return[n,2*xr(Pr(t))-dr]},mt.invert=mt,jt.invert=pt(xr),Pt.invert=pt(u),Ct.invert=pt(function(n){return 2+xr(n)}),qt.invert=function(n,t){return[-t,2*xr(Pr(n))-dr]},n.geoArea=E,n.geoBounds=T,n.geoCentroid=J,n.geoCircle=en,n.geoClipExtent=sn,n.geoDistance=Sn,n.geoGraticule=Mn,n.geoInterpolate=xn,n.geoLength=En,n.geoPath=Dn,n.geoAlbers=ct,n.geoAlbersUsa=at,n.geoAzimuthalEqualArea=st,n.geoAzimuthalEquidistant=vt,n.geoConicConformal=yt,n.geoConicEqualArea=ut,n.geoConicEquidistant=Nt,n.geoEquirectangular=Mt,n.geoGnomonic=wt,n.geoProjection=rt,n.geoProjectionMutator=it,n.geoMercator=ht,n.geoOrthographic=At,n.geoStereographic=bt,n.geoTransverseMercator=zt,n.geoRotation=nn,n.geoStream=s,n.geoTransform=Wn,Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "d3-geo",
"version": "0.0.4",
"version": "0.1.0",
"description": "Shapes and calculators for spherical coordinates.",

@@ -28,3 +28,3 @@ "keywords": [

"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-geo.js -c -m -o build/d3-geo.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-geo.js ../d3.github.com/d3-geo.v0.0.js && cp build/d3-geo.min.js ../d3.github.com/d3-geo.v0.0.min.js && cd ../d3.github.com && git add d3-geo.v0.0.js d3-geo.v0.0.min.js && git commit -m \"d3-geo ${VERSION}\" && git push && cd - && zip -j build/d3-geo.zip -- LICENSE README.md build/d3-geo.js build/d3-geo.min.js"
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-geo.js ../d3.github.com/d3-geo.v0.1.js && cp build/d3-geo.min.js ../d3.github.com/d3-geo.v0.1.min.js && cd ../d3.github.com && git add d3-geo.v0.1.js d3-geo.v0.1.min.js && git commit -m \"d3-geo ${VERSION}\" && git push && cd - && zip -j build/d3-geo.zip -- LICENSE README.md build/d3-geo.js build/d3-geo.min.js"
},

@@ -31,0 +31,0 @@ "dependencies": {

@@ -7,10 +7,10 @@ # d3-geo

If you use NPM, `npm install d3-geo`. Otherwise, download the [latest release](https://github.com/d3/d3-geo/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-geo.v0.0.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
If you use NPM, `npm install d3-geo`. Otherwise, download the [latest release](https://github.com/d3/d3-geo/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-geo.v0.1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
```html
<script src="https://d3js.org/d3-array.v1.min.js"></script>
<script src="https://d3js.org/d3-geo.v0.0.min.js"></script>
<script src="https://d3js.org/d3-geo.v0.1.min.js"></script>
<script>
var stream = d3.geoStream();
var path = d3.geoPath();

@@ -24,2 +24,9 @@ </script>

* [Math](#math)
* [Shapes](#shapes)
* [Projections](#projections)
* [Transforms](#transforms)
### Math
<a name="geoArea" href="#geoArea">#</a> d3.<b>geoArea</b>(<i>feature</i>)

@@ -147,2 +154,136 @@

### Projections
<a href="#geoPath" name="geoPath">#</a> d3.<b>geoPath</b>()
<a href="_path" name="_path">#</a> <i>path</i>(<i>object</i>)
<a href="#path_area" name="path_area">#</a> <i>path</i>.<b>area</b>(<i>object</i>)
<a href="#path_bounds" name="path_bounds">#</a> <i>path</i>.<b>bounds</b>(<i>object</i>)
<a href="#path_centroid" name="path_centroid">#</a> <i>path</i>.<b>centroid</b>(<i>object</i>)
<a href="#path_projection" name="path_projection">#</a><i>path</i>.<b>projection</b>([<i>projection</i>])
<a href="#path_context" name="path_context">#</a><i>path</i>.<b>context</b>([<i>context</i>])
<a href="#path_pointRadius" name="path_pointRadius">#</a><i>path</i>.<b>pointRadius</b>([<i>radius</i>])
<a href="#geoProjection" name="geoProjection">#</a> d3.<b>geoProjection</b>(<i>project</i>)
<a href="#geoProjectionMutator" name="geoProjectionMutator">#</a> d3.<b>geoProjectionMutator</b>(<i>projectFactory</i>)
<a href="#_projection" name="_projection">#</a> <i>projection</i>(<i>point</i>)
<a href="#projection_invert" name="projection_invert">#</a> <i>projection</i>.<b>invert</b>(<i>point</i>)
<a href="#projection_stream" name="projection_stream">#</a> <i>projection</i>.<b>stream</b>(<i>stream</i>)
<a href="#projection_clipAngle" name="projection_clipAngle">#</a> <i>projection</i>.<b>clipAngle</b>([<i>angle</i>])
<a href="#projection_clipExtent" name="projection_clipExtent">#</a> <i>projection</i>.<b>clipExtent</b>([<i>extent</i>])
<a href="#projection_scale" name="projection_scale">#</a> <i>projection</i>.<b>scale</b>([<i>scale</i>])
<a href="#projection_translate" name="projection_translate">#</a> <i>projection</i>.<b>translate</b>([<i>translate</i>])
<a href="#projection_center" name="projection_center">#</a> <i>projection</i>.<b>center</b>([<i>center</i>])
<a href="#projection_rotate" name="projection_rotate">#</a> <i>projection</i>.<b>rotate</b>([<i>rotate</i>])
<a href="#projection_precision" name="projection_precision">#</a> <i>projection</i>.<b>precision</b>([<i>precision</i>])
<a href="#geoAlbers" name="geoAlbers">#</a> d3.<b>geoAlbers</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/albers.png" width="480" height="250">
<a href="#geoAlbersUsa" name="geoAlbersUsa">#</a> d3.<b>geoAlbersUsa</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/albersUsa.png" width="480" height="250">
<a href="#geoAzimuthalEqualArea" name="geoAzimuthalEqualArea">#</a> d3.<b>geoAzimuthalEqualArea</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/azimuthalEqualArea.png" width="480" height="250">
<a href="#geoAzimuthalEquidistant" name="geoAzimuthalEquidistant">#</a> d3.<b>geoAzimuthalEquidistant</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/azimuthalEquidistant.png" width="480" height="250">
<a href="#geoConicConformal" name="geoConicConformal">#</a> d3.<b>geoConicConformal</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/conicConformal.png" width="480" height="250">
<a href="#geoConicEqualArea" name="geoConicEqualArea">#</a> d3.<b>geoConicEqualArea</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/conicEqualArea.png" width="480" height="250">
<a href="#geoConicEquidistant" name="geoConicEquidistant">#</a> d3.<b>geoConicEquidistant</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/conicEquidistant.png" width="480" height="250">
<a href="#geoEquirectangular" name="geoEquirectangular">#</a> d3.<b>geoEquirectangular</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/equirectangular.png" width="480" height="250">
<a href="#geoGnomonic" name="geoGnomonic">#</a> d3.<b>geoGnomonic</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/gnomonic.png" width="480" height="250">
<a href="#geoMercator" name="geoMercator">#</a> d3.<b>geoMercator</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/mercator.png" width="480" height="250">
<a href="#geoOrthographic" name="geoOrthographic">#</a> d3.<b>geoOrthographic</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/orthographic.png" width="480" height="250">
<a href="#geoStereographic" name="geoStereographic">#</a> d3.<b>geoStereographic</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/stereographic.png" width="480" height="250">
<a href="#geoTransverseMercator" name="geoTransverseMercator">#</a> d3.<b>geoTransverseMercator</b>()
<img src="https://raw.githubusercontent.com/d3/d3-geo/master/test/images/transverseMercator.png" width="480" height="250">
### Streams

@@ -152,13 +293,13 @@

Stream sinks must implement several methods to traverse geometry. Sinks are inherently stateful; the meaning of a [point](#point) depends on whether the point is inside of a [line](#lineStart), and likewise a line is distinguished from a ring by a [polygon](#polygonStart).
Streams must implement several methods to receive input geometry. Streams are inherently stateful; the meaning of a [point](#point) depends on whether the point is inside of a [line](#lineStart), and likewise a line is distinguished from a ring by a [polygon](#polygonStart).
<a name="sink_point" href="#sink_point">#</a> <i>sink</i>.<b>point</b>(<i>x</i>, <i>y</i>[, <i>z</i>])
<a name="stream_point" href="#stream_point">#</a> <i>stream</i>.<b>point</b>(<i>x</i>, <i>y</i>[, <i>z</i>])
Indicates a point with the specified coordinates *x* and *y* (and optionally *z*). The coordinate system is unspecified and implementation-dependent; for example, [projection streams](https://github.com/d3/d3-geo-projection) require spherical coordinates in degrees as input. Outside the context of a polygon or line, a point indicates a point geometry object ([Point](http://www.geojson.org/geojson-spec.html#point) or [MultiPoint](http://www.geojson.org/geojson-spec.html#multipoint)). Within a line or polygon ring, the point indicates a control point.
<a name="sink_lineStart" href="#sink_lineStart">#</a> <i>sink</i>.<b>lineStart</b>()
<a name="stream_lineStart" href="#stream_lineStart">#</a> <i>stream</i>.<b>lineStart</b>()
Indicates the start of a line or ring. Within a polygon, indicates the start of a ring. The first ring of a polygon is the exterior ring, and is typically clockwise. Any subsequent rings indicate holes in the polygon, and are typically counterclockwise.
<a name="sink_lineEnd" href="#sink_lineEnd">#</a> <i>sink</i>.<b>lineEnd</b>()
<a name="stream_lineEnd" href="#stream_lineEnd">#</a> <i>stream</i>.<b>lineEnd</b>()

@@ -176,29 +317,53 @@ Indicates the end of a line or ring. Within a polygon, indicates the end of a ring. Unlike GeoJSON, the redundant closing coordinate of a ring is *not* indicated via [point](#point), and instead is implied via lineEnd within a polygon. Thus, the given polygon input:

Will produce the following series of method calls on the sink:
Will produce the following series of method calls on the stream:
```js
sink.polygonStart();
sink.lineStart();
sink.point(0, 0);
sink.point(1, 0);
sink.point(1, 1);
sink.point(0, 1);
sink.lineEnd();
sink.polygonEnd();
stream.polygonStart();
stream.lineStart();
stream.point(0, 0);
stream.point(1, 0);
stream.point(1, 1);
stream.point(0, 1);
stream.lineEnd();
stream.polygonEnd();
```
<a name="sink_polygonStart" href="#sink_polygonStart">#</a> <i>sink</i>.<b>polygonStart</b>()
<a name="stream_polygonStart" href="#stream_polygonStart">#</a> <i>stream</i>.<b>polygonStart</b>()
Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes.
<a name="sink_polygonEnd" href="#sink_polygonEnd">#</a> <i>sink</i>.<b>polygonEnd</b>()
<a name="stream_polygonEnd" href="#stream_polygonEnd">#</a> <i>stream</i>.<b>polygonEnd</b>()
Indicates the end of a polygon.
<a name="sink_sphere" href="#sink_sphere">#</a> <i>sink</i>.<b>sphere</b>()
<a name="stream_sphere" href="#stream_sphere">#</a> <i>stream</i>.<b>sphere</b>()
Indicates the sphere (the globe; the unit sphere centered at ⟨0,0,0⟩).
<a href="#geoStream" name="geoStream">#</a> d3.<b>geoStream</b>(<i>object</i>, <i>sink</i>)
<a href="#geoStream" name="geoStream">#</a> d3.<b>geoStream</b>(<i>object</i>, <i>stream</i>)
Streams the specified [GeoJSON](http://geojson.org) *object* to the specified stream *sink*. (Despite the name “stream”, these method calls are currently synchronous.) While both features and geometry objects are supported as input, the stream interface only describes the geometry, and thus additional feature properties are not visible to sinks.
Streams the specified [GeoJSON](http://geojson.org) *object* to the specified *stream*. (Despite the name “stream”, these method calls are currently synchronous.) While both features and geometry objects are supported as input, the stream interface only describes the geometry, and thus additional feature properties are not visible to streams.
<a href="#geoTransform" name="geoTransform">#</a> d3.<b>geoTransform</b>(<i>prototype</i>)
Defines a simple transform projection, implementing [*projection*.stream](#projection_stream), using any methods defined on the specified *prototype*. Any undefined methods will use passthrough methods that propagate inputs to the output stream. For example, to invert the *y*-coordinates:
```js
var flipY = d3.geoTransform({
point: function(x, y) {
this.stream.point(x, -y);
}
});
```
Or to define an affine matrix transformation:
```js
function matrix(a, b, c, d, tx, ty) {
return d3.geoTransform({
point: function(x, y) {
this.stream.point(a * x + b * y + tx, c * x + d * y + ty);
}
});
}
```

@@ -15,3 +15,3 @@ import adder from "./adder";

export var areaSink = {
export var areaStream = {
point: noop,

@@ -22,4 +22,4 @@ lineStart: noop,

areaRingSum.reset();
areaSink.lineStart = areaRingStart;
areaSink.lineEnd = areaRingEnd;
areaStream.lineStart = areaRingStart;
areaStream.lineEnd = areaRingEnd;
},

@@ -37,3 +37,3 @@ polygonEnd: function() {

function areaRingStart() {
areaSink.point = areaPointFirst;
areaStream.point = areaPointFirst;
}

@@ -46,3 +46,3 @@

function areaPointFirst(lambda, phi) {
areaSink.point = areaPoint;
areaStream.point = areaPoint;
lambda00 = lambda, phi00 = phi;

@@ -77,4 +77,4 @@ lambda *= radians, phi *= radians;

else areaSum = adder(), areaRingSum = adder();
stream(object, areaSink);
stream(object, areaStream);
return areaSum * 2;
}
import adder from "./adder";
import {areaSink, areaRingSum} from "./area";
import {areaStream, areaRingSum} from "./area";
import {cartesian, cartesianCross, cartesianNormalizeInPlace, spherical} from "./cartesian";

@@ -15,3 +15,3 @@ import {abs, degrees, epsilon, radians} from "./math";

var boundsSink = {
var boundsStream = {
point: boundsPoint,

@@ -21,13 +21,13 @@ lineStart: boundsLineStart,

polygonStart: function() {
boundsSink.point = boundsRingPoint;
boundsSink.lineStart = boundsRingStart;
boundsSink.lineEnd = boundsRingEnd;
boundsStream.point = boundsRingPoint;
boundsStream.lineStart = boundsRingStart;
boundsStream.lineEnd = boundsRingEnd;
deltaSum.reset();
areaSink.polygonStart();
areaStream.polygonStart();
},
polygonEnd: function() {
areaSink.polygonEnd();
boundsSink.point = boundsPoint;
boundsSink.lineStart = boundsLineStart;
boundsSink.lineEnd = boundsLineEnd;
areaStream.polygonEnd();
boundsStream.point = boundsPoint;
boundsStream.lineStart = boundsLineStart;
boundsStream.lineEnd = boundsLineEnd;
if (areaRingSum < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);

@@ -94,3 +94,3 @@ else if (deltaSum > epsilon) phi1 = 90;

function boundsLineStart() {
boundsSink.point = linePoint;
boundsStream.point = linePoint;
}

@@ -100,3 +100,3 @@

range[0] = lambda0, range[1] = lambda1;
boundsSink.point = boundsPoint;
boundsStream.point = boundsPoint;
p0 = null;

@@ -112,3 +112,3 @@ }

}
areaSink.point(lambda, phi);
areaStream.point(lambda, phi);
linePoint(lambda, phi);

@@ -118,3 +118,3 @@ }

function boundsRingStart() {
areaSink.lineStart();
areaStream.lineStart();
}

@@ -124,3 +124,3 @@

boundsRingPoint(lambda00, phi00);
areaSink.lineEnd();
areaStream.lineEnd();
if (abs(deltaSum) > epsilon) lambda0 = -(lambda1 = 180);

@@ -153,3 +153,3 @@ range[0] = lambda0, range[1] = lambda1;

ranges = [];
stream(feature, boundsSink);
stream(feature, boundsStream);

@@ -156,0 +156,0 @@ // First, sort ranges by their minimum longitudes.

@@ -12,3 +12,3 @@ import {acos, asin, atan2, cos, degrees, epsilon, epsilon2, radians, sin, sqrt} from "./math";

var centroidSink = {
var centroidStream = {
sphere: noop,

@@ -19,8 +19,8 @@ point: centroidPoint,

polygonStart: function() {
centroidSink.lineStart = centroidRingStart;
centroidSink.lineEnd = centroidRingEnd;
centroidStream.lineStart = centroidRingStart;
centroidStream.lineEnd = centroidRingEnd;
},
polygonEnd: function() {
centroidSink.lineStart = centroidLineStart;
centroidSink.lineEnd = centroidLineEnd;
centroidStream.lineStart = centroidLineStart;
centroidStream.lineEnd = centroidLineEnd;
}

@@ -44,3 +44,3 @@ };

function centroidLineStart() {
centroidSink.point = centroidLinePointFirst;
centroidStream.point = centroidLinePointFirst;
}

@@ -54,3 +54,3 @@

z0 = sin(phi);
centroidSink.point = centroidLinePoint;
centroidStream.point = centroidLinePoint;
centroidPointCartesian(x0, y0, z0);

@@ -74,3 +74,3 @@ }

function centroidLineEnd() {
centroidSink.point = centroidPoint;
centroidStream.point = centroidPoint;
}

@@ -81,3 +81,3 @@

function centroidRingStart() {
centroidSink.point = centroidRingPointFirst;
centroidStream.point = centroidRingPointFirst;
}

@@ -87,3 +87,3 @@

centroidRingPoint(lambda00, phi00);
centroidSink.point = centroidPoint;
centroidStream.point = centroidPoint;
}

@@ -94,3 +94,3 @@

lambda *= radians, phi *= radians;
centroidSink.point = centroidRingPoint;
centroidStream.point = centroidRingPoint;
var cosPhi = cos(phi);

@@ -131,3 +131,3 @@ x0 = cosPhi * cos(lambda);

X2 = Y2 = Z2 = 0;
stream(object, centroidSink);
stream(object, centroidStream);

@@ -134,0 +134,0 @@ var x = X2,

@@ -7,3 +7,3 @@ import {cartesian, cartesianNormalizeInPlace, spherical} from "./cartesian";

// Generates a circle centered at [0°, 0°], with a given radius and precision.
export function circleStream(sink, radius, delta, direction, t0, t1) {
export function circleStream(stream, radius, delta, direction, t0, t1) {
if (!delta) return;

@@ -23,3 +23,3 @@ var cosRadius = cos(radius),

point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);
sink.point(point[0], point[1]);
stream.point(point[0], point[1]);
}

@@ -42,3 +42,3 @@ }

rotate,
sink = {point: point};
stream = {point: point};

@@ -56,3 +56,3 @@ function point(x, y) {

rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;
circleStream(sink, r, p, 1);
circleStream(stream, r, p, 1);
c = {type: "Polygon", coordinates: [ring]};

@@ -59,0 +59,0 @@ ring = rotate = null;

@@ -14,3 +14,3 @@ import clip from "./index";

// intersections, and the first and last segments should be rejoined.
function clipAntimeridianLine(sink) {
function clipAntimeridianLine(stream) {
var lambda0 = NaN,

@@ -23,3 +23,3 @@ phi0 = NaN,

lineStart: function() {
sink.lineStart();
stream.lineStart();
clean = 1;

@@ -31,8 +31,8 @@ },

if (abs(delta - pi) < epsilon) { // line crosses a pole
sink.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);
sink.point(sign0, phi0);
sink.lineEnd();
sink.lineStart();
sink.point(sign1, phi0);
sink.point(lambda1, phi0);
stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);
stream.point(sign0, phi0);
stream.lineEnd();
stream.lineStart();
stream.point(sign1, phi0);
stream.point(lambda1, phi0);
clean = 0;

@@ -43,13 +43,13 @@ } else if (sign0 !== sign1 && delta >= pi) { // line crosses antimeridian

phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
sink.point(sign0, phi0);
sink.lineEnd();
sink.lineStart();
sink.point(sign1, phi0);
stream.point(sign0, phi0);
stream.lineEnd();
stream.lineStart();
stream.point(sign1, phi0);
clean = 0;
}
sink.point(lambda0 = lambda1, phi0 = phi1);
stream.point(lambda0 = lambda1, phi0 = phi1);
sign0 = sign1;
},
lineEnd: function() {
sink.lineEnd();
stream.lineEnd();
lambda0 = phi0 = NaN;

@@ -74,24 +74,24 @@ },

function clipAntimeridianInterpolate(from, to, direction, sink) {
function clipAntimeridianInterpolate(from, to, direction, stream) {
var phi;
if (from == null) {
phi = direction * halfPi;
sink.point(-pi, phi);
sink.point(0, phi);
sink.point(pi, phi);
sink.point(pi, 0);
sink.point(pi, -phi);
sink.point(0, -phi);
sink.point(-pi, -phi);
sink.point(-pi, 0);
sink.point(-pi, phi);
stream.point(-pi, phi);
stream.point(0, phi);
stream.point(pi, phi);
stream.point(pi, 0);
stream.point(pi, -phi);
stream.point(0, -phi);
stream.point(-pi, -phi);
stream.point(-pi, 0);
stream.point(-pi, phi);
} else if (abs(from[0] - to[0]) > epsilon) {
var lambda = from[0] < to[0] ? pi : -pi;
phi = direction * lambda / 2;
sink.point(-lambda, phi);
sink.point(0, phi);
sink.point(lambda, phi);
stream.point(-lambda, phi);
stream.point(0, phi);
stream.point(lambda, phi);
} else {
sink.point(to[0], to[1]);
stream.point(to[0], to[1]);
}
}

@@ -12,4 +12,4 @@ import {cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical} from "../cartesian";

function interpolate(from, to, direction, sink) {
circleStream(sink, radius, delta, direction, from, to);
function interpolate(from, to, direction, stream) {
circleStream(stream, radius, delta, direction, from, to);
}

@@ -25,3 +25,3 @@

// should be rejoined.
function clipLine(sink) {
function clipLine(stream) {
var point0, // previous point

@@ -44,3 +44,3 @@ c0, // code for previous point

: v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
if (!point0 && (v00 = v0 = v)) sink.lineStart();
if (!point0 && (v00 = v0 = v)) stream.lineStart();
// Handle degeneracies.

@@ -60,10 +60,10 @@ // TODO ignore if not clipping polygons.

// outside going in
sink.lineStart();
stream.lineStart();
point2 = intersect(point1, point0);
sink.point(point2[0], point2[1]);
stream.point(point2[0], point2[1]);
} else {
// inside going out
point2 = intersect(point0, point1);
sink.point(point2[0], point2[1]);
sink.lineEnd();
stream.point(point2[0], point2[1]);
stream.lineEnd();
}

@@ -78,11 +78,11 @@ point0 = point2;

if (smallRadius) {
sink.lineStart();
sink.point(t[0][0], t[0][1]);
sink.point(t[1][0], t[1][1]);
sink.lineEnd();
stream.lineStart();
stream.point(t[0][0], t[0][1]);
stream.point(t[1][0], t[1][1]);
stream.lineEnd();
} else {
sink.point(t[1][0], t[1][1]);
sink.lineEnd();
sink.lineStart();
sink.point(t[0][0], t[0][1]);
stream.point(t[1][0], t[1][1]);
stream.lineEnd();
stream.lineStart();
stream.point(t[0][0], t[0][1]);
}

@@ -92,3 +92,3 @@ }

if (v && (!point0 || !pointEqual(point0, point1))) {
sink.point(point1[0], point1[1]);
stream.point(point1[0], point1[1]);
}

@@ -98,3 +98,3 @@ point0 = point1, v0 = v, c0 = c;

lineEnd: function() {
if (v0) sink.lineEnd();
if (v0) stream.lineEnd();
point0 = null;

@@ -101,0 +101,0 @@ },

@@ -18,3 +18,3 @@ import {abs, epsilon} from "../math";

function interpolate(from, to, direction, sink) {
function interpolate(from, to, direction, stream) {
var a = 0, a1 = 0;

@@ -24,6 +24,6 @@ if (from == null

|| comparePoint(from, to) < 0 ^ direction > 0) {
do sink.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
while ((a = (a + direction + 4) % 4) !== a1);
} else {
sink.point(to[0], to[1]);
stream.point(to[0], to[1]);
}

@@ -53,5 +53,5 @@ }

return function(sink) {
var activeSink = sink,
bufferSink = clipBuffer(),
return function(stream) {
var activeStream = stream,
bufferStream = clipBuffer(),
segments,

@@ -65,3 +65,3 @@ polygon,

var clipSink = {
var clipStream = {
point: point,

@@ -75,3 +75,3 @@ lineStart: lineStart,

function point(x, y) {
if (visible(x, y)) activeSink.point(x, y);
if (visible(x, y)) activeStream.point(x, y);
}

@@ -95,3 +95,3 @@

function polygonStart() {
activeSink = bufferSink, segments = [], polygon = [], clean = true;
activeStream = bufferStream, segments = [], polygon = [], clean = true;
}

@@ -104,18 +104,18 @@

if (cleanInside || visible) {
sink.polygonStart();
stream.polygonStart();
if (cleanInside) {
sink.lineStart();
interpolate(null, null, 1, sink);
sink.lineEnd();
stream.lineStart();
interpolate(null, null, 1, stream);
stream.lineEnd();
}
if (visible) {
clipPolygon(segments, compareIntersection, startInside, interpolate, sink);
clipPolygon(segments, compareIntersection, startInside, interpolate, stream);
}
sink.polygonEnd();
stream.polygonEnd();
}
activeSink = sink, segments = polygon = ring = null;
activeStream = stream, segments = polygon = ring = null;
}
function lineStart() {
clipSink.point = linePoint;
clipStream.point = linePoint;
if (polygon) polygon.push(ring = []);

@@ -133,7 +133,7 @@ first = true;

linePoint(x__, y__);
if (v__ && v_) bufferSink.rejoin();
segments.push(bufferSink.result());
if (v__ && v_) bufferStream.rejoin();
segments.push(bufferStream.result());
}
clipSink.point = point;
if (v_) activeSink.lineEnd();
clipStream.point = point;
if (v_) activeStream.lineEnd();
}

@@ -148,7 +148,7 @@

if (v) {
activeSink.lineStart();
activeSink.point(x, y);
activeStream.lineStart();
activeStream.point(x, y);
}
} else {
if (v && v_) activeSink.point(x, y);
if (v && v_) activeStream.point(x, y);
else {

@@ -159,11 +159,11 @@ var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],

if (!v_) {
activeSink.lineStart();
activeSink.point(a[0], a[1]);
activeStream.lineStart();
activeStream.point(a[0], a[1]);
}
activeSink.point(b[0], b[1]);
if (!v) activeSink.lineEnd();
activeStream.point(b[0], b[1]);
if (!v) activeStream.lineEnd();
clean = false;
} else if (v) {
activeSink.lineStart();
activeSink.point(x, y);
activeStream.lineStart();
activeStream.point(x, y);
clean = false;

@@ -176,3 +176,3 @@ }

return clipSink;
return clipStream;
};

@@ -186,14 +186,14 @@ }

y1 = 500,
stream,
streamSink,
cache,
cacheStream,
clip;
return clip = {
stream: function(sink) {
return stream && streamSink === sink ? stream : stream = clipExtent(x0, y0, x1, y1)(streamSink = sink);
stream: function(stream) {
return cache && cacheStream === stream ? cache : cache = clipExtent(x0, y0, x1, y1)(cacheStream = stream);
},
extent: function(_) {
return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], stream = streamSink = null, clip) : [[x0, y0], [x1, y1]];
return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]];
}
};
}

@@ -15,3 +15,3 @@ import pointEqual from "../pointEqual";

// along the clip edge.
export default function(segments, compareIntersection, startInside, interpolate, sink) {
export default function(segments, compareIntersection, startInside, interpolate, stream) {
var subject = [],

@@ -30,5 +30,5 @@ clip = [],

if (pointEqual(p0, p1)) {
sink.lineStart();
for (i = 0; i < n; ++i) sink.point((p0 = segment[i])[0], p0[1]);
sink.lineEnd();
stream.lineStart();
for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);
stream.lineEnd();
return;

@@ -63,3 +63,3 @@ }

points = current.z;
sink.lineStart();
stream.lineStart();
do {

@@ -69,5 +69,5 @@ current.v = current.o.v = true;

if (isSubject) {
for (i = 0, n = points.length; i < n; ++i) sink.point((point = points[i])[0], point[1]);
for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);
} else {
interpolate(current.x, current.n.x, 1, sink);
interpolate(current.x, current.n.x, 1, stream);
}

@@ -78,5 +78,5 @@ current = current.n;

points = current.p.z;
for (i = points.length - 1; i >= 0; --i) sink.point((point = points[i])[0], point[1]);
for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);
} else {
interpolate(current.x, current.p.x, -1, sink);
interpolate(current.x, current.p.x, -1, stream);
}

@@ -89,3 +89,3 @@ current = current.p;

} while (!current.v);
sink.lineEnd();
stream.lineEnd();
}

@@ -92,0 +92,0 @@ }

@@ -11,3 +11,3 @@ import adder from "./adder";

var lengthSink = {
var lengthStream = {
sphere: noop,

@@ -22,8 +22,8 @@ point: noop,

function lengthLineStart() {
lengthSink.point = lengthPointFirst;
lengthSink.lineEnd = lengthLineEnd;
lengthStream.point = lengthPointFirst;
lengthStream.lineEnd = lengthLineEnd;
}
function lengthLineEnd() {
lengthSink.point = lengthSink.lineEnd = noop;
lengthStream.point = lengthStream.lineEnd = noop;
}

@@ -34,3 +34,3 @@

lambda0 = lambda, sinPhi0 = sin(phi), cosPhi0 = cos(phi);
lengthSink.point = lengthPoint;
lengthStream.point = lengthPoint;
}

@@ -55,4 +55,4 @@

else lengthSum = adder();
stream(object, lengthSink);
stream(object, lengthStream);
return +lengthSum;
}

@@ -12,3 +12,3 @@ import adder from "../adder";

var areaSink = {
var areaStream = {
point: noop,

@@ -18,7 +18,7 @@ lineStart: noop,

polygonStart: function() {
areaSink.lineStart = areaRingStart;
areaSink.lineEnd = areaRingEnd;
areaStream.lineStart = areaRingStart;
areaStream.lineEnd = areaRingEnd;
},
polygonEnd: function() {
areaSink.lineStart = areaSink.lineEnd = areaSink.point = noop;
areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;
areaSum.add(abs(areaRingSum));

@@ -35,7 +35,7 @@ areaRingSum.reset();

function areaRingStart() {
areaSink.point = areaPointFirst;
areaStream.point = areaPointFirst;
}
function areaPointFirst(x, y) {
areaSink.point = areaPoint;
areaStream.point = areaPoint;
x00 = x0 = x, y00 = y0 = y;

@@ -53,2 +53,2 @@ }

export default areaSink;
export default areaStream;

@@ -8,3 +8,3 @@ import noop from "../noop";

var boundsSink = {
var boundsStream = {
point: boundsPoint,

@@ -29,2 +29,2 @@ lineStart: noop,

export default boundsSink;
export default boundsStream;

@@ -19,3 +19,3 @@ import {sqrt} from "../math";

var centroidSink = {
var centroidStream = {
point: centroidPoint,

@@ -25,9 +25,9 @@ lineStart: centroidLineStart,

polygonStart: function() {
centroidSink.lineStart = centroidRingStart;
centroidSink.lineEnd = centroidRingEnd;
centroidStream.lineStart = centroidRingStart;
centroidStream.lineEnd = centroidRingEnd;
},
polygonEnd: function() {
centroidSink.point = centroidPoint;
centroidSink.lineStart = centroidLineStart;
centroidSink.lineEnd = centroidLineEnd;
centroidStream.point = centroidPoint;
centroidStream.lineStart = centroidLineStart;
centroidStream.lineEnd = centroidLineEnd;
},

@@ -53,7 +53,7 @@ result: function() {

function centroidLineStart() {
centroidSink.point = centroidPointFirstLine;
centroidStream.point = centroidPointFirstLine;
}
function centroidPointFirstLine(x, y) {
centroidSink.point = centroidPointLine;
centroidStream.point = centroidPointLine;
centroidPoint(x0 = x, y0 = y);

@@ -71,7 +71,7 @@ }

function centroidLineEnd() {
centroidSink.point = centroidPoint;
centroidStream.point = centroidPoint;
}
function centroidRingStart() {
centroidSink.point = centroidPointFirstRing;
centroidStream.point = centroidPointFirstRing;
}

@@ -84,3 +84,3 @@

function centroidPointFirstRing(x, y) {
centroidSink.point = centroidPointRing;
centroidStream.point = centroidPointRing;
centroidPoint(x00 = x0 = x, y00 = y0 = y);

@@ -105,2 +105,2 @@ }

export default centroidSink;
export default centroidStream;

@@ -12,4 +12,4 @@ import identity from "../identity";

projection,
projectionStream,
context,
projectStream,
contextStream;

@@ -20,3 +20,3 @@

if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
stream(object, projectStream(contextStream));
stream(object, projectionStream(contextStream));
}

@@ -27,3 +27,3 @@ return contextStream.result();

path.area = function(object) {
stream(object, projectStream(pathArea));
stream(object, projectionStream(pathArea));
return pathArea.result();

@@ -33,3 +33,3 @@ };

path.bounds = function(object) {
stream(object, projectStream(pathBounds));
stream(object, projectionStream(pathBounds));
return pathBounds.result();

@@ -39,3 +39,3 @@ };

path.centroid = function(object) {
stream(object, projectStream(pathCentroid));
stream(object, projectionStream(pathCentroid));
return pathCentroid.result();

@@ -45,5 +45,3 @@ };

path.projection = function(_) {
if (!arguments.length) return projection;
projectStream = (projection = _) ? _.stream : identity;
return path;
return arguments.length ? (projectionStream = (projection = _) == null ? identity : _.stream, path) : projection;
};

@@ -64,3 +62,3 @@

return path.projection(null).context(null); // TODO albersUsa
return path.projection(null).context(null);
}

@@ -5,3 +5,3 @@ export default function() {

var sink = {
var stream = {
point: point,

@@ -11,11 +11,11 @@ lineStart: lineStart,

polygonStart: function() {
sink.lineEnd = lineEndPolygon;
stream.lineEnd = lineEndPolygon;
},
polygonEnd: function() {
sink.lineEnd = lineEnd;
sink.point = point;
stream.lineEnd = lineEnd;
stream.point = point;
},
pointRadius: function(_) {
pointCircle = circle(_);
return sink;
return stream;
},

@@ -37,3 +37,3 @@ result: function() {

string.push("M", x, ",", y);
sink.point = pointLine;
stream.point = pointLine;
}

@@ -46,7 +46,7 @@

function lineStart() {
sink.point = pointLineStart;
stream.point = pointLineStart;
}
function lineEnd() {
sink.point = point;
stream.point = point;
}

@@ -58,3 +58,3 @@

return sink;
return stream;
}

@@ -61,0 +61,0 @@

@@ -7,11 +7,11 @@ import {epsilon} from "../math";

// as this will avoid emitting interleaving lines and polygons.
function multiplex(sinks) {
var n = sinks.length;
function multiplex(streams) {
var n = streams.length;
return {
point: function(x, y) { var i = -1; while (++i < n) sinks[i].point(x, y); },
sphere: function() { var i = -1; while (++i < n) sinks[i].sphere(); },
lineStart: function() { var i = -1; while (++i < n) sinks[i].lineStart(); },
lineEnd: function() { var i = -1; while (++i < n) sinks[i].lineEnd(); },
polygonStart: function() { var i = -1; while (++i < n) sinks[i].polygonStart(); },
polygonEnd: function() { var i = -1; while (++i < n) sinks[i].polygonEnd(); }
point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },
sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },
lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },
lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },
polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },
polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }
};

@@ -25,8 +25,8 @@ }

export default function() {
var stream,
streamSink,
var cache,
cacheStream,
lower48 = albers(), lower48Point,
alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338
hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007
point, pointSink = {point: function(x, y) { point = [x, y]; }};
point, pointStream = {point: function(x, y) { point = [x, y]; }};

@@ -51,4 +51,4 @@ function albersUsa(coordinates) {

albersUsa.stream = function(sink) {
return stream && streamSink === sink ? stream : stream = multiplex([lower48.stream(streamSink = sink), alaska.stream(sink), hawaii.stream(sink)]);
albersUsa.stream = function(stream) {
return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);
};

@@ -75,3 +75,3 @@

.clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])
.stream(pointSink);
.stream(pointStream);

@@ -81,3 +81,3 @@ alaskaPoint = alaska

.clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]])
.stream(pointSink);
.stream(pointStream);

@@ -87,3 +87,3 @@ hawaiiPoint = hawaii

.clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]])
.stream(pointSink);
.stream(pointStream);

@@ -90,0 +90,0 @@ return albersUsa;

@@ -0,1 +1,2 @@

import {pi} from "../math";
import projection from "./index";

@@ -10,3 +11,3 @@

export default function() {
return projection(equirectangular);
return projection(equirectangular).scale(480 / pi);
}

@@ -8,3 +8,3 @@ import clipAntimeridian from "../clip/antimeridian";

import {rotateRadians} from "../rotation";
import transform from "../transform";
import {transform} from "../transform";
import resample from "./resample";

@@ -31,4 +31,4 @@

delta2 = 0.5, projectResample = resample(projectTransform, delta2), // precision
stream,
streamSink;
cache,
cacheStream;

@@ -49,4 +49,4 @@ function projection(point) {

projection.stream = function(sink) {
return stream && streamSink === sink ? stream : stream = transformRadians(preclip(rotate, projectResample(postclip(streamSink = sink))));
projection.stream = function(stream) {
return cache && cacheStream === stream ? cache : cache = transformRadians(preclip(rotate, projectResample(postclip(cacheStream = stream))));
};

@@ -91,3 +91,3 @@

function reset() {
stream = streamSink = null;
cache = cacheStream = null;
return projection;

@@ -94,0 +94,0 @@ }

import {cartesian} from "../cartesian";
import {abs, asin, atan2, cos, epsilon, radians, sqrt} from "../math";
import transform from "../transform";
import {transform} from "../transform";

@@ -49,3 +49,2 @@ var maxDepth = 16, // maximum depth of subdivision

}
return function(stream) {

@@ -55,8 +54,8 @@ var lambda00, x00, y00, a00, b00, c00, // first point

var resampleSink = {
var resampleStream = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() { stream.polygonStart(); resampleSink.lineStart = ringStart; },
polygonEnd: function() { stream.polygonEnd(); resampleSink.lineStart = lineStart; }
polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },
polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }
};

@@ -71,3 +70,3 @@

x0 = NaN;
resampleSink.point = linePoint;
resampleStream.point = linePoint;
stream.lineStart();

@@ -83,3 +82,3 @@ }

function lineEnd() {
resampleSink.point = point;
resampleStream.point = point;
stream.lineEnd();

@@ -90,4 +89,4 @@ }

lineStart();
resampleSink.point = ringPoint;
resampleSink.lineEnd = ringEnd;
resampleStream.point = ringPoint;
resampleStream.lineEnd = ringEnd;
}

@@ -97,3 +96,3 @@

linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
resampleSink.point = linePoint;
resampleStream.point = linePoint;
}

@@ -103,8 +102,8 @@

resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);
resampleSink.lineEnd = lineEnd;
resampleStream.lineEnd = lineEnd;
lineEnd();
}
return resampleSink;
return resampleStream;
};
}

@@ -1,4 +0,4 @@

function streamGeometry(geometry, sink) {
function streamGeometry(geometry, stream) {
if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
streamGeometryType[geometry.type](geometry, sink);
streamGeometryType[geometry.type](geometry, stream);
}

@@ -8,8 +8,8 @@ }

var streamObjectType = {
Feature: function(feature, sink) {
streamGeometry(feature.geometry, sink);
Feature: function(feature, stream) {
streamGeometry(feature.geometry, stream);
},
FeatureCollection: function(object, sink) {
FeatureCollection: function(object, stream) {
var features = object.features, i = -1, n = features.length;
while (++i < n) streamGeometry(features[i].geometry, sink);
while (++i < n) streamGeometry(features[i].geometry, stream);
}

@@ -19,53 +19,53 @@ };

var streamGeometryType = {
Sphere: function(object, sink) {
sink.sphere();
Sphere: function(object, stream) {
stream.sphere();
},
Point: function(object, sink) {
Point: function(object, stream) {
object = object.coordinates;
sink.point(object[0], object[1], object[2]);
stream.point(object[0], object[1], object[2]);
},
MultiPoint: function(object, sink) {
MultiPoint: function(object, stream) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) object = coordinates[i], sink.point(object[0], object[1], object[2]);
while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);
},
LineString: function(object, sink) {
streamLine(object.coordinates, sink, 0);
LineString: function(object, stream) {
streamLine(object.coordinates, stream, 0);
},
MultiLineString: function(object, sink) {
MultiLineString: function(object, stream) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) streamLine(coordinates[i], sink, 0);
while (++i < n) streamLine(coordinates[i], stream, 0);
},
Polygon: function(object, sink) {
streamPolygon(object.coordinates, sink);
Polygon: function(object, stream) {
streamPolygon(object.coordinates, stream);
},
MultiPolygon: function(object, sink) {
MultiPolygon: function(object, stream) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) streamPolygon(coordinates[i], sink);
while (++i < n) streamPolygon(coordinates[i], stream);
},
GeometryCollection: function(object, sink) {
GeometryCollection: function(object, stream) {
var geometries = object.geometries, i = -1, n = geometries.length;
while (++i < n) streamGeometry(geometries[i], sink);
while (++i < n) streamGeometry(geometries[i], stream);
}
};
function streamLine(coordinates, sink, closed) {
function streamLine(coordinates, stream, closed) {
var i = -1, n = coordinates.length - closed, coordinate;
sink.lineStart();
while (++i < n) coordinate = coordinates[i], sink.point(coordinate[0], coordinate[1], coordinate[2]);
sink.lineEnd();
stream.lineStart();
while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);
stream.lineEnd();
}
function streamPolygon(coordinates, sink) {
function streamPolygon(coordinates, stream) {
var i = -1, n = coordinates.length;
sink.polygonStart();
while (++i < n) streamLine(coordinates[i], sink, 1);
sink.polygonEnd();
stream.polygonStart();
while (++i < n) streamLine(coordinates[i], stream, 1);
stream.polygonEnd();
}
export default function(object, sink) {
export default function(object, stream) {
if (object && streamObjectType.hasOwnProperty(object.type)) {
streamObjectType[object.type](object, sink);
streamObjectType[object.type](object, stream);
} else {
streamGeometry(object, sink);
streamGeometry(object, stream);
}
}

@@ -1,2 +0,8 @@

export default function transform(prototype) {
export default function(prototype) {
return {
stream: transform(prototype)
};
}
export function transform(prototype) {
function T() {}

@@ -3,0 +9,0 @@ var p = T.prototype = Object.create(Transform.prototype);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc