diff --git a/javascript/build/ee_api_js.js b/javascript/build/ee_api_js.js index 6a2892f01..eaaeb60b2 100644 --- a/javascript/build/ee_api_js.js +++ b/javascript/build/ee_api_js.js @@ -1,81 +1,79 @@ (function() {var h,aa=aa||{},k=this,l=function(a){return void 0!==a},ba=function(){},ca=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!= typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},n=function(a){return"array"==ca(a)},da=function(a){var b=ca(a);return"array"==b||"object"==b&&"number"==typeof a.length},p=function(a){return"string"==typeof a},ea=function(a){return"number"==typeof a},q=function(a){return"function"==ca(a)},r=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},fa="closure_uid_"+ -(1E9*Math.random()>>>0),ga=0,ha=function(a,b,c){return a.call.apply(a.bind,arguments)},ja=function(a,b,c){if(!a)throw Error();if(2>>0),ga=0,ia=function(a,b,c){return a.call.apply(a.bind,arguments)},ja=function(a,b,c){if(!a)throw Error();if(2b?1:0};var Aa=function(a,b){b.unshift(a);w.call(this,xa.apply(null,b));b.shift()};v(Aa,w);Aa.prototype.name="AssertionError"; -var Ba=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),g=d;else a&&(e+=": "+a,g=b);throw new Aa(""+e,g||[]);},y=function(a,b,c){a||Ba("",null,b,Array.prototype.slice.call(arguments,2));return a},Ca=function(a,b){throw new Aa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},Da=function(a,b,c){q(a)||Ba("Expected function but got %s: %s.",[ca(a),a],b,Array.prototype.slice.call(arguments,2))};var z=Array.prototype,Ea=z.indexOf?function(a,b,c){y(null!=a.length);return z.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(p(a))return p(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:p(a)?a.charAt(b):a[b]},Ka=function(a,b){var c= -Ea(a,b),d;if(d=0<=c)y(null!=a.length),z.splice.call(a,c,1);return d},La=function(a){return z.concat.apply(z,arguments)},Ma=function(a,b){for(var c=1;c=arguments.length?z.slice.call(a,b):z.slice.call(a,b,c)},Oa=function(a){for(var b={},c=0,d=0;db?1:0};var Aa=function(a,b){b.unshift(a);w.call(this,xa.apply(null,b));b.shift()};v(Aa,w);Aa.prototype.name="AssertionError"; +var Ba=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),g=d;else a&&(e+=": "+a,g=b);throw new Aa(""+e,g||[]);},x=function(a,b,c){a||Ba("",null,b,Array.prototype.slice.call(arguments,2));return a},Ca=function(a,b){throw new Aa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},Da=function(a,b,c){q(a)||Ba("Expected function but got %s: %s.",[ca(a),a],b,Array.prototype.slice.call(arguments,2))};var y=Array.prototype,Ea=y.indexOf?function(a,b,c){x(null!=a.length);return y.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(p(a))return p(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:p(a)?a.charAt(b):a[b]},Ka=function(a,b){var c= +Ea(a,b),d;if(d=0<=c)x(null!=a.length),y.splice.call(a,c,1);return d},La=function(a){return y.concat.apply(y,arguments)},Ma=function(a,b){for(var c=1;c=arguments.length?y.slice.call(a,b):y.slice.call(a,b,c)},Oa=function(a){for(var b={},c=0,d=0;dparseFloat(a))?String(b):a}(),hb={},C=function(a){var b;if(!(b=hb[a])){b=0;for(var c=ya(String(gb)).split("."),d=ya(String(a)).split("."),e=Math.max(c.length,d.length),g=0;0==b&&gparseFloat(a))?String(b):a}(),hb={},B=function(a){var b;if(!(b=hb[a])){b=0;for(var c=ya(String(gb)).split("."),d=ya(String(a)).split("."),e=Math.max(c.length,d.length),g=0;0==b&&g=b.La&&b.cancel())}this.rb?this.rb.call(this.jb,this):this.bb=!0;this.T||Ub(this,new Vb)}};Tb.prototype.ib=function(a,b){this.Ka=!1;Wb(this,a,b)}; -var Wb=function(a,b,c){a.T=!0;a.I=c;a.fa=!b;Xb(a)},Zb=function(a){if(a.T){if(!a.bb)throw new Yb;a.bb=!1}},Ub=function(a,b){Zb(a);$b(b);Wb(a,!1,b)},$b=function(a){y(!(a instanceof Tb),"An execution sequence may not be initiated with a blocking Deferred.")},ac=function(a,b,c){y(!a.fb,"Blocking Deferreds can not be re-used");a.Aa.push([b,c,void 0]);a.T&&Xb(a)}; +var Wb=function(a,b,c){a.T=!0;a.I=c;a.fa=!b;Xb(a)},Zb=function(a){if(a.T){if(!a.bb)throw new Yb;a.bb=!1}},Ub=function(a,b){Zb(a);$b(b);Wb(a,!1,b)},$b=function(a){x(!(a instanceof Tb),"An execution sequence may not be initiated with a blocking Deferred.")},ac=function(a,b,c){x(!a.fb,"Blocking Deferreds can not be re-used");a.Aa.push([b,c,void 0]);a.T&&Xb(a)}; Tb.prototype.then=function(a,b,c){var d,e,g=new Fb(function(a,b){d=a;e=b});ac(this,d,function(a){a instanceof Vb?g.cancel():e(a)});return g.then(a,b,c)};Ab(Tb); var bc=function(a){return Ha(a.Aa,function(a){return q(a[1])})},Xb=function(a){if(a.Ea&&a.T&&bc(a)){var b=a.Ea,c=cc[b];c&&(k.clearTimeout(c.ga),delete cc[b]);a.Ea=0}a.g&&(a.g.La--,delete a.g);for(var b=a.I,d=c=!1;a.Aa.length&&!a.Ka;){var e=a.Aa.shift(),g=e[0],f=e[1],e=e[2];if(g=a.fa?f:g)try{var m=g.call(e||a.jb,b);l(m)&&(a.fa=a.fa&&(m==b||m instanceof Error),a.I=b=m);if(Bb(b)||"function"===typeof k.Promise&&b instanceof k.Promise)d=!0,a.Ka=!0}catch(L){b=L,a.fa=!0,bc(a)||(c=!0)}}a.I=b;d&&(m=t(a.ib, a,!0),d=t(a.ib,a,!1),b instanceof Tb?(ac(b,m,d),b.fb=!0):b.then(m,d));c&&(b=new dc(b),cc[b.ga]=b,a.Ea=b.ga)},Yb=function(){w.call(this)};v(Yb,w);Yb.prototype.message="Deferred has already fired";Yb.prototype.name="AlreadyCalledError";var Vb=function(){w.call(this)};v(Vb,w);Vb.prototype.message="Deferred was canceled";Vb.prototype.name="CanceledError";var dc=function(a){this.ga=k.setTimeout(t(this.rc,this),0);this.qa=a}; -dc.prototype.rc=function(){y(cc[this.ga],"Cannot throw an error that is not scheduled.");delete cc[this.ga];throw this.qa;};var cc={};var ic=function(a){var b={},c=b.document||document,d=document.createElement("SCRIPT"),e={vb:d,ja:void 0},g=new Tb(ec,e),f=null,m=null!=b.timeout?b.timeout:5E3;0=a.keyCode)a.keyCode=-1}catch(b){}};var pc="closure_listenable_"+(1E6*Math.random()|0),qc=0;var rc=function(a,b,c,d,e){this.listener=a;this.ya=null;this.src=b;this.type=c;this.oa=!!d;this.sa=e;this.key=++qc;this.W=this.na=!1},sc=function(a){a.W=!0;a.listener=null;a.ya=null;a.src=null;a.sa=null};var tc=function(a){this.src=a;this.o={};this.ka=0};tc.prototype.add=function(a,b,c,d,e){var g=a.toString();a=this.o[g];a||(a=this.o[g]=[],this.ka++);var f=uc(a,b,d,e);-1=a.keyCode)a.keyCode=-1}catch(b){}};var pc="closure_listenable_"+(1E6*Math.random()|0),qc=0;var rc=function(a,b,c,d,e){this.listener=a;this.ya=null;this.src=b;this.type=c;this.oa=!!d;this.sa=e;this.key=++qc;this.W=this.na=!1},sc=function(a){a.W=!0;a.listener=null;a.ya=null;a.src=null;a.sa=null};var tc=function(a){this.src=a;this.o={};this.ka=0};tc.prototype.add=function(a,b,c,d,e){var g=a.toString();a=this.o[g];a||(a=this.o[g]=[],this.ka++);var f=uc(a,b,d,e);-1e.keyCode||void 0!=e.returnValue)){a:{var g=!1;if(0==e.keyCode)try{e.keyCode= --1;break a}catch(f){g=!0}if(g||void 0==e.returnValue)e.returnValue=!0}e=[];for(g=c.currentTarget;g;g=g.parentNode)e.push(g);for(var g=a.type,m=e.length-1;!c.V&&0<=m;m--){c.currentTarget=e[m];var L=Ic(e[m],g,!0,c),d=d&&L}for(m=0;!c.V&&m>>0),Ac=function(a){y(a,"Listener can not be null.");if(q(a))return a; -y(a.handleEvent,"An object listener must have handleEvent method.");a[Jc]||(a[Jc]=function(b){return a.handleEvent(b)});return a[Jc]};var Kc=function(){jc.call(this);this.C=new tc(this);this.Eb=this;this.$a=null};v(Kc,jc);Kc.prototype[pc]=!0;h=Kc.prototype;h.addEventListener=function(a,b,c,d){zc(this,a,b,c,d)};h.removeEventListener=function(a,b,c,d){Fc(this,a,b,c,d)}; -h.dispatchEvent=function(a){Lc(this);var b,c=this.$a;if(c){b=[];for(var d=1;c;c=c.$a)b.push(c),y(1E3>++d,"infinite loop")}c=this.Eb;d=a.type||a;if(p(a))a=new kc(a,c);else if(a instanceof kc)a.target=a.target||c;else{var e=a;a=new kc(d,c);va(a,e)}var e=!0,g;if(b)for(var f=b.length-1;!a.V&&0<=f;f--)g=a.currentTarget=b[f],e=Mc(g,d,!0,a)&&e;a.V||(g=a.currentTarget=c,e=Mc(g,d,!0,a)&&e,a.V||(e=Mc(g,d,!1,a)&&e));if(b)for(f=0;!a.V&&f>>0),Ac=function(a){x(a,"Listener can not be null.");if(q(a))return a; +x(a.handleEvent,"An object listener must have handleEvent method.");a[Jc]||(a[Jc]=function(b){return a.handleEvent(b)});return a[Jc]};var Kc=function(){jc.call(this);this.C=new tc(this);this.Eb=this;this.$a=null};v(Kc,jc);Kc.prototype[pc]=!0;h=Kc.prototype;h.addEventListener=function(a,b,c,d){zc(this,a,b,c,d)};h.removeEventListener=function(a,b,c,d){Fc(this,a,b,c,d)}; +h.dispatchEvent=function(a){Lc(this);var b,c=this.$a;if(c){b=[];for(var d=1;c;c=c.$a)b.push(c),x(1E3>++d,"infinite loop")}c=this.Eb;d=a.type||a;if(p(a))a=new kc(a,c);else if(a instanceof kc)a.target=a.target||c;else{var e=a;a=new kc(d,c);va(a,e)}var e=!0,g;if(b)for(var f=b.length-1;!a.V&&0<=f;f--)g=a.currentTarget=b[f],e=Mc(g,d,!0,a)&&e;a.V||(g=a.currentTarget=c,e=Mc(g,d,!0,a)&&e,a.V||(e=Mc(g,d,!1,a)&&e));if(b)for(f=0;!a.V&&f2*this.m&&Qc(this),!0):!1};var Qc=function(a){if(a.m!=a.j.length){for(var b=0,c=0;b=d.j.length)throw Nc;var e=d.j[b++];return a?e:d.D[e]};return e};var Rc=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var Sc=function(a){if("function"==typeof a.H)return a.H();if(p(a))return a.split("");if(da(a)){for(var b=[],c=a.length,d=0;d=ad(this).value)for(q(b)&&(b=b()),a=new Uc(a,String(b),this.hc),c&&(a.lb=c),c="log:"+a.gc,k.console&&(k.console.timeStamp?k.console.timeStamp(c):k.console.markTimeline&&k.console.markTimeline(c)),k.msWriteProfilerMark&&k.msWriteProfilerMark(c),c=this;c;){b=c;var d=a;if(b.nb)for(var e=0,g=void 0;g=b.nb[e];e++)g(d);c=c.getParent()}}; -var bd={},cd=null,dd=function(a){cd||(cd=new Wc(""),bd[""]=cd,cd.xb(Zc));var b;if(!(b=bd[a])){b=new Wc(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=dd(a.substr(0,c));c.Vb()[d]=b;b.g=c;bd[a]=b}return b};var ed=function(a,b){a&&a.log($c,b,void 0)};var fd=function(a,b,c){if(q(a))c&&(a=t(a,c));else if(a&&"function"==typeof a.handleEvent)a=t(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647b&&(b+=e);return[Gd,"map",a.mapid,d,b,c].join("/")+"?token="+a.token});var Qd=function(a,b){a=sa(a);return F("/value",G(a),b)};u("ee.data.getValue",Qd);var Rd=function(a,b){a=sa(a);n(a.size)&&(a.size=a.size.join("x"));var c=G(a).add("getid","1");return F("/thumb",c,b)};u("ee.data.getThumbId",Rd);var Sd=function(a){return Gd+"/api/thumb?thumbid="+a.thumbid+"&token="+a.token};u("ee.data.makeThumbUrl",Sd); -var Td=function(a,b){a=sa(a);return F("/download",G(a),b)};u("ee.data.getDownloadId",Td);var Ud=function(a){return Gd+"/api/download?docid="+a.docid+"&token="+a.token};u("ee.data.makeDownloadUrl",Ud);var Vd=function(a,b){a=sa(a);return F("/table",G(a),b)};u("ee.data.getTableDownloadId",Vd);var Wd=function(a){return Gd+"/api/table?docid="+a.docid+"&token="+a.token};u("ee.data.makeTableDownloadUrl",Wd); -u("ee.data.createAsset",function(a,b,c,d){a={value:a};void 0!==b&&(a.id=b);a.force=c||!1;return F("/create",G(a),d)});u("ee.data.createFolder",function(a,b,c){return F("/createfolder",G({id:a,force:b||!1}),c)});u("ee.data.newTaskId",function(a,b){var c={};ea(a)&&(c.count=a);return F("/newtaskid",G(c),b)});u("ee.data.getTaskStatus",function(a,b){if(p(a))a=[a];else if(!n(a))throw Error("Invalid taskId: expected a string or an array of strings.");return F("/taskstatus?q="+a.join(),null,b,"GET")}); -u("ee.data.getTaskList",function(a){return F("/tasklist",null,a,"GET")});u("ee.data.cancelTask",function(a,b){return Xd(a,"CANCEL",b)});var Xd=function(a,b,c){if(p(a))a=[a];else if(!n(a))throw Error("Invalid taskId: expected a string or an array of strings.");var d;a:{for(d in Md)if(Md[d]==b){d=!0;break a}d=!1}if(!d)throw Error("Invalid action: "+b);return F("/updatetask",G({id:a,action:b}),c,"POST")};u("ee.data.updateTask",Xd); -u("ee.data.prepareValue",function(a,b,c){b=sa(b);b.tid=a;return F("/prepare",G(b),c)});u("ee.data.startProcessing",function(a,b,c){b=sa(b);b.id=a;return F("/processingrequest",G(b),c)});u("ee.data.startIngestion",function(a,b,c){a={id:a,request:Ta(b)};return F("/ingestionrequest",G(a),c)});u("ee.data.createAssetHome",function(a,b){var c=G({id:a});F("/createbucket",c,b)});u("ee.data.getAssetRoots",function(a){return F("/buckets",null,a,"GET")}); -u("ee.data.getAssetAcl",function(a,b){return F("/getacl",G({id:a}),b,"GET")});u("ee.data.setAssetAcl",function(a,b,c){a={id:a,value:Ta(b)};F("/setacl",G(a),c)}); -var F=function(a,b,c,d){Nd();d=d||"POST";var e={"Content-Type":"application/x-www-form-urlencoded"};null!=Id&&(e.Authorization=Id);null!=Hd&&("GET"==d?(a+=x(a,"?")?"&":"?",a+="xsrfToken="+Hd):(b||(b=new Cd),b.add("xsrfToken",Hd)));var g=function(a,b,c,d){var e,g,f;b=b?b.replace(/;.*/,""):"application/json";if("application/json"==b||"text/json"==b)try{e=Qa(c),g=e.data}catch(m){f="Invalid JSON: "+c}else f="Response was unexpectedly not JSON, but "+b;if(r(e))"error"in e&&"message"in e.error?f=e.error.message: -"data"in e||(f="Malformed response: "+c);else if(200>a||300<=a)f="Server returned HTTP code: "+a;if(d)return d(g,f),null;if(!f)return g;throw Error(f);};b=b?b.toString():"";"GET"!=d||/^[\s\xa0]*$/.test(b)||(a+=x(a,"?")?"&":"?",a+=b,b=null);a=Fd+a;if(c)return ud(a,function(a){a=a.target;var b=a.getStatus(),d=a.getResponseHeader("Content-Type"),e;try{e=a.a?a.a.responseText:""}catch(f){ed(a.w,"Can not get responseText: "+f.message),e=""}return g(b,d,e,c)},d,b,e),null;var f=D();f.open(d,a,!1);la(e,function(a, -b){f.setRequestHeader(b,a)});f.send(b);var m;try{m=f.getResponseHeader("Content-Type")}catch(L){m="application/json"}return g(f.status,m,f.responseText,null)},Od=function(a,b){var c={client_id:Jd,immediate:!0,scope:Kd.join(" ")},d=function(c){c.access_token?(Id=c.token_type+" "+c.access_token,setTimeout(Od,1E3*c.expires_in/2),a&&a()):b&&b(c.error||"Unknown error.")},e=k.gapi.auth.authorize;e(c,function(a){"immediate_failed"==a.error?(c.immediate=!1,e(c,d)):d(a)})},G=function(a){var b=new Cd,c;for(c in a)b.set(c, -a[c]);return b};var Yd=function(){};var Zd=function(){this.F=-1};var $d=function(){this.F=-1;this.F=64;this.i=Array(4);this.Gb=Array(this.F);this.Ca=this.$=0;this.reset()};v($d,Zd);$d.prototype.reset=function(){this.i[0]=1732584193;this.i[1]=4023233417;this.i[2]=2562383102;this.i[3]=271733878;this.Ca=this.$=0}; +u("ee.data.getXsrfToken",function(){return Hd});u("ee.data.getInfo",function(a,b){return E("/info",(new Cd).add("id",a),b)});u("ee.data.getList",function(a,b){var c=F(a);return E("/list",c,b)});var Pd=function(a,b){a=sa(a);return E("/mapid",F(a),b)};u("ee.data.getMapId",Pd);u("ee.data.getTileUrl",function(a,b,c,d){var e=Math.pow(2,d);b%=e;0>b&&(b+=e);return[Gd,"map",a.mapid,d,b,c].join("/")+"?token="+a.token});var Qd=function(a,b){a=sa(a);return E("/value",F(a),b)};u("ee.data.getValue",Qd); +var Rd=function(a,b){a=sa(a);n(a.size)&&(a.size=a.size.join("x"));var c=F(a).add("getid","1");return E("/thumb",c,b)};u("ee.data.getThumbId",Rd);var Sd=function(a){return Gd+"/api/thumb?thumbid="+a.thumbid+"&token="+a.token};u("ee.data.makeThumbUrl",Sd);var Td=function(a,b){a=sa(a);return E("/download",F(a),b)};u("ee.data.getDownloadId",Td);var Ud=function(a){return Gd+"/api/download?docid="+a.docid+"&token="+a.token};u("ee.data.makeDownloadUrl",Ud); +var Vd=function(a,b){a=sa(a);return E("/table",F(a),b)};u("ee.data.getTableDownloadId",Vd);var Wd=function(a){return Gd+"/api/table?docid="+a.docid+"&token="+a.token};u("ee.data.makeTableDownloadUrl",Wd);u("ee.data.createAsset",function(a,b,c,d){a={value:a};void 0!==b&&(a.id=b);a.force=c||!1;return E("/create",F(a),d)});u("ee.data.createFolder",function(a,b,c){return E("/createfolder",F({id:a,force:b||!1}),c)}); +u("ee.data.newTaskId",function(a,b){var c={};ea(a)&&(c.count=a);return E("/newtaskid",F(c),b)});u("ee.data.getTaskStatus",function(a,b){if(p(a))a=[a];else if(!n(a))throw Error("Invalid taskId: expected a string or an array of strings.");return E("/taskstatus?q="+a.join(),null,b,"GET")});u("ee.data.getTaskList",function(a){return E("/tasklist",null,a,"GET")});u("ee.data.cancelTask",function(a,b){return Xd(a,"CANCEL",b)}); +var Xd=function(a,b,c){if(p(a))a=[a];else if(!n(a))throw Error("Invalid taskId: expected a string or an array of strings.");var d;a:{for(d in Md)if(Md[d]==b){d=!0;break a}d=!1}if(!d)throw Error("Invalid action: "+b);return E("/updatetask",F({id:a,action:b}),c,"POST")};u("ee.data.updateTask",Xd);u("ee.data.prepareValue",function(a,b,c){b=sa(b);b.tid=a;return E("/prepare",F(b),c)});u("ee.data.startProcessing",function(a,b,c){b=sa(b);b.id=a;return E("/processingrequest",F(b),c)}); +u("ee.data.startIngestion",function(a,b,c){a={id:a,request:Ta(b)};return E("/ingestionrequest",F(a),c)});u("ee.data.createAssetHome",function(a,b){var c=F({id:a});E("/createbucket",c,b)});u("ee.data.getAssetRoots",function(a){return E("/buckets",null,a,"GET")});u("ee.data.getAssetAcl",function(a,b){return E("/getacl",F({id:a}),b,"GET")});u("ee.data.setAssetAcl",function(a,b,c){a={id:a,value:Ta(b)};E("/setacl",F(a),c)}); +var E=function(a,b,c,d){Nd();d=d||"POST";var e={"Content-Type":"application/x-www-form-urlencoded"};null!=Id&&(e.Authorization=Id);null!=Hd&&(e["X-XSRF-Token"]=Hd);var g=function(a,b,c,d){var e,g,f;b=b?b.replace(/;.*/,""):"application/json";if("application/json"==b||"text/json"==b)try{e=Ra(c),g=e.data}catch(m){f="Invalid JSON: "+c}else f="Response was unexpectedly not JSON, but "+b;if(r(e))"error"in e&&"message"in e.error?f=e.error.message:"data"in e||(f="Malformed response: "+c);else if(200>a||300<= +a)f="Server returned HTTP code: "+a;if(d)return d(g,f),null;if(!f)return g;throw Error(f);};b=b?b.toString():"";"GET"!=d||/^[\s\xa0]*$/.test(b)||(a+=-1!=a.indexOf("?")?"&":"?",a+=b,b=null);a=Fd+a;if(c)return ud(a,function(a){a=a.target;var b=a.getStatus(),d=a.getResponseHeader("Content-Type"),e;try{e=a.a?a.a.responseText:""}catch(f){ed(a.w,"Can not get responseText: "+f.message),e=""}return g(b,d,e,c)},d,b,e),null;var f=C();f.open(d,a,!1);la(e,function(a,b){f.setRequestHeader(b,a)});f.send(b);var m; +try{m=f.getResponseHeader("Content-Type")}catch(L){m="application/json"}return g(f.status,m,f.responseText,null)},Od=function(a,b){var c={client_id:Jd,immediate:!0,scope:Kd.join(" ")},d=function(c){c.access_token?(Id=c.token_type+" "+c.access_token,setTimeout(Od,1E3*c.expires_in/2),a&&a()):b&&b(c.error||"Unknown error.")},e=k.gapi.auth.authorize;e(c,function(a){"immediate_failed"==a.error?(c.immediate=!1,e(c,d)):d(a)})},F=function(a){var b=new Cd,c;for(c in a)b.set(c,a[c]);return b};var Yd=function(){};var Zd=function(){this.F=-1};var $d=function(){this.F=-1;this.F=64;this.i=Array(4);this.Gb=Array(this.F);this.Ca=this.$=0;this.reset()};v($d,Zd);$d.prototype.reset=function(){this.i[0]=1732584193;this.i[1]=4023233417;this.i[2]=2562383102;this.i[3]=271733878;this.Ca=this.$=0}; var ae=function(a,b,c){c||(c=0);var d=Array(16);if(p(b))for(var e=0;16>e;++e)d[e]=b.charCodeAt(c++)|b.charCodeAt(c++)<<8|b.charCodeAt(c++)<<16|b.charCodeAt(c++)<<24;else for(e=0;16>e;++e)d[e]=b[c++]|b[c++]<<8|b[c++]<<16|b[c++]<<24;b=a.i[0];c=a.i[1];var e=a.i[2],g=a.i[3],f=0,f=b+(g^c&(e^g))+d[0]+3614090360&4294967295;b=c+(f<<7&4294967295|f>>>25);f=g+(e^b&(c^e))+d[1]+3905402710&4294967295;g=b+(f<<12&4294967295|f>>>20);f=e+(c^g&(b^c))+d[2]+606105819&4294967295;e=g+(f<<17&4294967295|f>>>15);f=c+(b^e& (g^b))+d[3]+3250441966&4294967295;c=e+(f<<22&4294967295|f>>>10);f=b+(g^c&(e^g))+d[4]+4118548399&4294967295;b=c+(f<<7&4294967295|f>>>25);f=g+(e^b&(c^e))+d[5]+1200080426&4294967295;g=b+(f<<12&4294967295|f>>>20);f=e+(c^g&(b^c))+d[6]+2821735955&4294967295;e=g+(f<<17&4294967295|f>>>15);f=c+(b^e&(g^b))+d[7]+4249261313&4294967295;c=e+(f<<22&4294967295|f>>>10);f=b+(g^c&(e^g))+d[8]+1770035416&4294967295;b=c+(f<<7&4294967295|f>>>25);f=g+(e^b&(c^e))+d[9]+2336552879&4294967295;g=b+(f<<12&4294967295|f>>>20);f= e+(c^g&(b^c))+d[10]+4294925233&4294967295;e=g+(f<<17&4294967295|f>>>15);f=c+(b^e&(g^b))+d[11]+2304563134&4294967295;c=e+(f<<22&4294967295|f>>>10);f=b+(g^c&(e^g))+d[12]+1804603682&4294967295;b=c+(f<<7&4294967295|f>>>25);f=g+(e^b&(c^e))+d[13]+4254626195&4294967295;g=b+(f<<12&4294967295|f>>>20);f=e+(c^g&(b^c))+d[14]+2792965006&4294967295;e=g+(f<<17&4294967295|f>>>15);f=c+(b^e&(g^b))+d[15]+1236535329&4294967295;c=e+(f<<22&4294967295|f>>>10);f=b+(e^g&(c^e))+d[1]+4129170786&4294967295;b=c+(f<<5&4294967295| @@ -87,72 +85,72 @@ g=b+(f<<11&4294967295|f>>>21);f=e+(g^b^c)+d[15]+530742520&4294967295;e=g+(f<<16& (f<<6&4294967295|f>>>26);f=g+(c^(b|~e))+d[3]+2399980690&4294967295;g=b+(f<<10&4294967295|f>>>22);f=e+(b^(g|~c))+d[10]+4293915773&4294967295;e=g+(f<<15&4294967295|f>>>17);f=c+(g^(e|~b))+d[1]+2240044497&4294967295;c=e+(f<<21&4294967295|f>>>11);f=b+(e^(c|~g))+d[8]+1873313359&4294967295;b=c+(f<<6&4294967295|f>>>26);f=g+(c^(b|~e))+d[15]+4264355552&4294967295;g=b+(f<<10&4294967295|f>>>22);f=e+(b^(g|~c))+d[6]+2734768916&4294967295;e=g+(f<<15&4294967295|f>>>17);f=c+(g^(e|~b))+d[13]+1309151649&4294967295; c=e+(f<<21&4294967295|f>>>11);f=b+(e^(c|~g))+d[4]+4149444226&4294967295;b=c+(f<<6&4294967295|f>>>26);f=g+(c^(b|~e))+d[11]+3174756917&4294967295;g=b+(f<<10&4294967295|f>>>22);f=e+(b^(g|~c))+d[2]+718787259&4294967295;e=g+(f<<15&4294967295|f>>>17);f=c+(g^(e|~b))+d[9]+3951481745&4294967295;a.i[0]=a.i[0]+b&4294967295;a.i[1]=a.i[1]+(e+(f<<21&4294967295|f>>>11))&4294967295;a.i[2]=a.i[2]+e&4294967295;a.i[3]=a.i[3]+g&4294967295}; $d.prototype.update=function(a,b){l(b)||(b=a.length);for(var c=b-this.F,d=this.Gb,e=this.$,g=0;gthis.$?this.F:2*this.F)-this.$);a[0]=128;for(var b=1;bb;++b)for(var d=0;32>d;d+=8)a[c++]=this.i[b]>>>d&255;return a};var be=function(a){this.la="__ee_hash__";this.Xa=!1!==a;this.X=[];this.S={};this.eb=[]};u("ee.Serializer",be);var ce=new Ra,de=new $d,ge=function(a,b){return fe(new be(l(b)?b:!0),a)};u("ee.Serializer.encode",ge);var he=function(a){return ce.l(ge(a))};u("ee.Serializer.toJSON",he);var ie=function(a){a=fe(new be(!1),a);return"JSON"in k?k.JSON.stringify(a,null," "):ce.l(a)};u("ee.Serializer.toReadableJSON",ie); +$d.prototype.digest=function(){var a=Array((56>this.$?this.F:2*this.F)-this.$);a[0]=128;for(var b=1;bb;++b)for(var d=0;32>d;d+=8)a[c++]=this.i[b]>>>d&255;return a};var be=function(a){this.la="__ee_hash__";this.Xa=!1!==a;this.X=[];this.S={};this.eb=[]};u("ee.Serializer",be);var ce=new Sa,de=new $d,ge=function(a,b){return fe(new be(l(b)?b:!0),a)};u("ee.Serializer.encode",ge);var he=function(a){return ce.l(ge(a))};u("ee.Serializer.toJSON",he);var ie=function(a){a=fe(new be(!1),a);return"JSON"in k?k.JSON.stringify(a,null," "):ce.l(a)};u("ee.Serializer.toReadableJSON",ie); var fe=function(a,b){var c=a.pa(b);a.Xa&&(c=r(c)&&"ValueRef"==c.type&&1==a.X.length?a.X[0][1]:{type:"CompoundValue",scope:a.X,value:c},a.X=[],Fa(a.eb,t(function(a){delete a[this.la]},a)),a.eb=[],a.S={});return c}; be.prototype.pa=function(a){if(!l(a))throw Error("Can't encode an undefined value.");var b,c=r(a)?a[this.la]:null;if(this.Xa&&null!=c&&this.S[c])return{type:"ValueRef",value:this.S[c]};if(null===a||"boolean"==typeof a||ea(a)||p(a))return a;if(r(a)&&"function"==typeof a.getFullYear)return{type:"Invocation",functionName:"Date",arguments:{value:Math.floor(a.getTime())}};if(a instanceof Yd){if(b=a.encode(t(this.pa,this)),!(n(b)||r(b)&&"ArgumentRef"!=b.type))return b}else if(n(a))b=Ga(a,function(a){return this.pa(a)}, -this);else if(r(a)&&!q(a))b=oa(a,function(a){if(!q(a))return this.pa(a)},this),ra(b,this.la),b={type:"Dictionary",value:b};else throw Error("Can't encode object: "+a);if(this.Xa){de.reset();de.update(ce.l(b));var c=de.digest().toString(),d;this.S[c]?d=this.S[c]:(d=String(this.X.length),this.X.push([d,b]),this.S[c]=d);a[this.la]=c;this.eb.push(a);return{type:"ValueRef",value:d}}return b};var H=function(a,b,c){if(!(this instanceof H))return I(H,arguments);if(c&&(a||b))throw Error('When "opt_varName" is specified, "func" and "args" must be null.');if(a&&!b)throw Error('When "func" is specified, "args" must not be null.');this.b=a;this.c=b;this.h=c||null};v(H,Yd);u("ee.ComputedObject",H);H.prototype.u=function(a){return Qd({json:this.l()},a)};u("ee.ComputedObject.prototype.getInfo",H.prototype.u); -H.prototype.encode=function(a){if(null===this.b&&null===this.c)return{type:"ArgumentRef",value:this.h};var b={},c;for(c in this.c)l(this.c[c])&&(b[c]=a(this.c[c]));b={type:"Invocation",arguments:b};a=a(this.b);b[p(a)?"functionName":"function"]=a;return b};H.prototype.l=function(){return he(this)};u("ee.ComputedObject.prototype.serialize",H.prototype.l);H.prototype.toString=function(){return"ee."+this.name()+"("+ie(this)+")"};u("ee.ComputedObject.prototype.toString",H.prototype.toString); -H.prototype.name=function(){return"ComputedObject"};var je=function(a,b){if(b instanceof a.constructor)return b;var c=function(){};c.prototype=a.constructor.prototype;c=new c;c.b=b.b;c.c=b.c;c.h=b.h;return c},I=function(a,b){function c(){return a.apply(this,b)}c.prototype=a.prototype;return new c};var ke={},le=function(a){return a.prototype instanceof H?a.prototype.name.call(null):a==Number?"Number":a==String?"String":a==Array?"Array":a==Date?"Date":"Object"},me=function(a,b){if(b==a)return!0;switch(a){case "Element":return"Element"==b||"Image"==b||"Feature"==b||"Collection"==b||"ImageCollection"==b||"FeatureCollection"==b;case "FeatureCollection":case "Collection":return"Collection"==b||"ImageCollection"==b||"FeatureCollection"==b;case "Object":return!0;default:return!1}},ne=function(a){return ea(a)|| -a instanceof H&&"Number"==a.name()},oe=function(a){return p(a)||a instanceof H&&"String"==a.name()},pe=function(a){return r(a)&&!q(a)?(a=Object.getPrototypeOf(a),null!==a&&null===Object.getPrototypeOf(a)):!1};var J=function(){if(!(this instanceof J))return new J};v(J,Yd);u("ee.Function",J);var qe=function(a){return a};J.prototype.call=function(a){return this.apply(re(this,Array.prototype.slice.call(arguments,0)))};u("ee.Function.prototype.call",J.prototype.call);J.prototype.apply=function(a){a=new H(this,se(this,a));return qe(a,this.v().returns)};u("ee.Function.prototype.apply",J.prototype.apply); +this);else if(r(a)&&!q(a))b=oa(a,function(a){if(!q(a))return this.pa(a)},this),ra(b,this.la),b={type:"Dictionary",value:b};else throw Error("Can't encode object: "+a);if(this.Xa){de.reset();de.update(ce.l(b));var c=de.digest().toString(),d;this.S[c]?d=this.S[c]:(d=String(this.X.length),this.X.push([d,b]),this.S[c]=d);a[this.la]=c;this.eb.push(a);return{type:"ValueRef",value:d}}return b};var G=function(a,b,c){if(!(this instanceof G))return H(G,arguments);if(c&&(a||b))throw Error('When "opt_varName" is specified, "func" and "args" must be null.');if(a&&!b)throw Error('When "func" is specified, "args" must not be null.');this.b=a;this.c=b;this.h=c||null};v(G,Yd);u("ee.ComputedObject",G);G.prototype.u=function(a){return Qd({json:this.l()},a)};u("ee.ComputedObject.prototype.getInfo",G.prototype.u); +G.prototype.encode=function(a){if(null===this.b&&null===this.c)return{type:"ArgumentRef",value:this.h};var b={},c;for(c in this.c)l(this.c[c])&&(b[c]=a(this.c[c]));b={type:"Invocation",arguments:b};a=a(this.b);b[p(a)?"functionName":"function"]=a;return b};G.prototype.l=function(){return he(this)};u("ee.ComputedObject.prototype.serialize",G.prototype.l);G.prototype.toString=function(){return"ee."+this.name()+"("+ie(this)+")"};u("ee.ComputedObject.prototype.toString",G.prototype.toString); +G.prototype.name=function(){return"ComputedObject"};var je=function(a,b){if(b instanceof a.constructor)return b;var c=function(){};c.prototype=a.constructor.prototype;c=new c;c.b=b.b;c.c=b.c;c.h=b.h;return c},H=function(a,b){function c(){return a.apply(this,b)}c.prototype=a.prototype;return new c};var ke={},le=function(a){return a.prototype instanceof G?a.prototype.name.call(null):a==Number?"Number":a==String?"String":a==Array?"Array":a==Date?"Date":"Object"},me=function(a,b){if(b==a)return!0;switch(a){case "Element":return"Element"==b||"Image"==b||"Feature"==b||"Collection"==b||"ImageCollection"==b||"FeatureCollection"==b;case "FeatureCollection":case "Collection":return"Collection"==b||"ImageCollection"==b||"FeatureCollection"==b;case "Object":return!0;default:return!1}},ne=function(a){return ea(a)|| +a instanceof G&&"Number"==a.name()},oe=function(a){return p(a)||a instanceof G&&"String"==a.name()},pe=function(a){return r(a)&&!q(a)?(a=Object.getPrototypeOf(a),null!==a&&null===Object.getPrototypeOf(a)):!1};var I=function(){if(!(this instanceof I))return new I};v(I,Yd);u("ee.Function",I);var qe=function(a){return a};I.prototype.call=function(a){return this.apply(re(this,Array.prototype.slice.call(arguments,0)))};u("ee.Function.prototype.call",I.prototype.call);I.prototype.apply=function(a){a=new G(this,se(this,a));return qe(a,this.v().returns)};u("ee.Function.prototype.apply",I.prototype.apply); var te=function(a,b,c){var d=l(b),e=a.v(),g=!1;if(1==c.length&&pe(c[0])){var f=e.args;d&&(f=f.slice(1));f.length&&(g=!((1==f.length||f[1].optional)&&"Dictionary"==f[0].type))}if(g){if(c=sa(c[0]),d){d=e.args[0].name;if(d in c)throw Error("Named args for "+e.name+" can't contain keyword "+d);c[d]=b}}else c=re(a,d?[b].concat(c):c);return a.apply(c)},se=function(a,b){for(var c=a.v().args,d={},e={},g=0;g/,"");for(var c=0;c/,"");return new K(b,a)}),a&&a())};a?F("/algorithms",null,c,"GET"):c(F("/algorithms",null,void 0,"GET"))}},N=function(a,b,c,d){xe();var e=d||"";la(ma,function(d,f){var m=f.split(".");if(2==m.length&&m[0]==b){var m=e+m[1],L=d.v();we[f]=!0;var ia=!1; -if(L.args.length)var W=L.args[0].type,ia="Object"!=W&&me(W,c);W=ia?a.prototype:a;m in W||(W[m]=function(a){return te(d,ia?this:void 0,Array.prototype.slice.call(arguments,0))},W[m].toString=t(d.toString,d,m,ia),W[m].signature=L)}})},O=function(a){var b=function(a){for(var b in a)q(a[b])&&a[b].signature&&delete a[b]};b(a);b(a.prototype)};var P=function(a,b,c){H.call(this,a,b,c);Be()};v(P,H);u("ee.Element",P);var Ce=!1,Be=function(){Ce||(N(P,"Element","Element"),Ce=!0)};P.prototype.name=function(){return"Element"}; -P.prototype.set=function(a){var b;if(1>=arguments.length){var c=arguments[0];if(b=pe(c))a:{b=qa(c);var d=["properties"];if(da(b)&&da(d)&&b.length==d.length){for(var e=b.length,g=0;g/,"");for(var c=0;c/,"");return new J(b,a)}),a&&a())};a?E("/algorithms",null,c,"GET"):c(E("/algorithms",null,void 0,"GET"))}},M=function(a,b,c,d){xe();var e=d||"";la(ma,function(d,f){var m=f.split(".");if(2==m.length&&m[0]==b){var m=e+m[1],L=d.v();we[f]=!0;var ha=!1; +if(L.args.length)var V=L.args[0].type,ha="Object"!=V&&me(V,c);V=ha?a.prototype:a;m in V||(V[m]=function(a){return te(d,ha?this:void 0,Array.prototype.slice.call(arguments,0))},V[m].toString=t(d.toString,d,m,ha),V[m].signature=L)}})},N=function(a){var b=function(a){for(var b in a)q(a[b])&&a[b].signature&&delete a[b]};b(a);b(a.prototype)};var O=function(a,b,c){G.call(this,a,b,c);Be()};v(O,G);u("ee.Element",O);var Ce=!1,Be=function(){Ce||(M(O,"Element","Element"),Ce=!0)};O.prototype.name=function(){return"Element"}; +O.prototype.set=function(a){var b;if(1>=arguments.length){var c=arguments[0];if(b=pe(c))a:{b=qa(c);var d=["properties"];if(da(b)&&da(d)&&b.length==d.length){for(var e=b.length,g=0;gb||4/,"");c[e]=!0}var g=k.ee,f;for(f in b)f in c&&!(f in g)&&(g[f]=Yf(f),Wf.push(f),a[f]?(g[f].signature=a[f],g[f].signature.isConstructor=!0,we[f]=!0):g[f].signature={});ke=g;Zf()}catch(m){Vf(m);return}Rf="ready";for(Sf=[];0/,"");c[e]=!0}var g=k.ee,f;for(f in b)f in c&&!(f in g)&&(g[f]=Xf(f),Vf.push(f),a[f]?(g[f].signature=a[f],g[f].signature.isConstructor=!0,we[f]=!0):g[f].signature={});ke=g;Yf()}catch(m){Uf(m);return}Qf="ready";for(Rf=[];0|undefined), + * gain: (number|Array|undefined), + * bias: (number|Array|undefined), + * min: (number|Array|undefined), + * max: (number|Array|undefined), + * gamma: (number|Array|undefined), + * palette: (string|Array|undefined), + * opacity: (number|undefined), + * format: (string|undefined) + * }} + */ +ee.data.ImageVisualizationParameters; + + /** * An object describing an Image band, as returned by getValue. * The dimensions field is [width, height]. diff --git a/javascript/src/deps.js b/javascript/src/deps.js index af3ca8961..3959df14c 100644 --- a/javascript/src/deps.js +++ b/javascript/src/deps.js @@ -8,7 +8,7 @@ goog.addDependency('../../geo/gestalt/client/javascript/apitestcase.js', ['ee.Ap goog.addDependency('../../geo/gestalt/client/javascript/collection.js', ['ee.Collection'], ['ee.ApiFunction', 'ee.Element', 'ee.Filter'], false); goog.addDependency('../../geo/gestalt/client/javascript/computedobject.js', ['ee.ComputedObject'], ['ee.Encodable', 'ee.Serializer', 'ee.data'], false); goog.addDependency('../../geo/gestalt/client/javascript/customfunction.js', ['ee.CustomFunction'], ['ee.ComputedObject', 'ee.Function', 'ee.Number', 'ee.Serializer', 'ee.String', 'ee.Types', 'goog.array', 'goog.object'], false); -goog.addDependency('../../geo/gestalt/client/javascript/data.js', ['ee.data', 'ee.data.AbstractTaskConfig', 'ee.data.AlgorithmArgument', 'ee.data.AlgorithmSignature', 'ee.data.AlgorithmsRegistry', 'ee.data.AssetAcl', 'ee.data.AssetAclUpdate', 'ee.data.AssetDescription', 'ee.data.AssetList', 'ee.data.AssetType', 'ee.data.Band', 'ee.data.BandDescription', 'ee.data.DownloadId', 'ee.data.FeatureCollectionDescription', 'ee.data.FileSource', 'ee.data.Fileset', 'ee.data.FolderDescription', 'ee.data.GMEProject', 'ee.data.GeoJSONFeature', 'ee.data.GeoJSONGeometry', 'ee.data.ImageCollectionDescription', 'ee.data.ImageDescription', 'ee.data.ImageTaskConfig', 'ee.data.IngestionRequest', 'ee.data.MapId', 'ee.data.PixelTypeDescription', 'ee.data.ProcessingResponse', 'ee.data.RawMapId', 'ee.data.ShortAssetDescription', 'ee.data.TableTaskConfig', 'ee.data.TaskListResponse', 'ee.data.TaskStatus', 'ee.data.TaskUpdateActions', 'ee.data.ThumbnailId', 'ee.data.VideoTaskConfig'], ['goog.Uri', 'goog.array', 'goog.json', 'goog.net.XhrIo', 'goog.net.XmlHttp', 'goog.net.jsloader', 'goog.object', 'goog.string'], false); +goog.addDependency('../../geo/gestalt/client/javascript/data.js', ['ee.data', 'ee.data.AbstractTaskConfig', 'ee.data.AlgorithmArgument', 'ee.data.AlgorithmSignature', 'ee.data.AlgorithmsRegistry', 'ee.data.AssetAcl', 'ee.data.AssetAclUpdate', 'ee.data.AssetDescription', 'ee.data.AssetList', 'ee.data.AssetType', 'ee.data.Band', 'ee.data.BandDescription', 'ee.data.DownloadId', 'ee.data.FeatureCollectionDescription', 'ee.data.FeatureVisualizationParameters', 'ee.data.FileSource', 'ee.data.Fileset', 'ee.data.FolderDescription', 'ee.data.GMEProject', 'ee.data.GeoJSONFeature', 'ee.data.GeoJSONGeometry', 'ee.data.ImageCollectionDescription', 'ee.data.ImageDescription', 'ee.data.ImageTaskConfig', 'ee.data.ImageVisualizationParameters', 'ee.data.IngestionRequest', 'ee.data.MapId', 'ee.data.PixelTypeDescription', 'ee.data.ProcessingResponse', 'ee.data.RawMapId', 'ee.data.ShortAssetDescription', 'ee.data.TableTaskConfig', 'ee.data.TaskListResponse', 'ee.data.TaskStatus', 'ee.data.TaskUpdateActions', 'ee.data.ThumbnailId', 'ee.data.VideoTaskConfig'], ['goog.Uri', 'goog.array', 'goog.json', 'goog.net.XhrIo', 'goog.net.XmlHttp', 'goog.net.jsloader', 'goog.object', 'goog.string'], false); goog.addDependency('../../geo/gestalt/client/javascript/date.js', ['ee.Date'], ['ee.ApiFunction', 'ee.ComputedObject', 'ee.Types'], false); goog.addDependency('../../geo/gestalt/client/javascript/deserializer.js', ['ee.Deserializer'], ['ee.ApiFunction', 'ee.ComputedObject', 'ee.CustomFunction', 'ee.Date', 'ee.Encodable', 'ee.Function', 'ee.Geometry', 'goog.array', 'goog.json', 'goog.object'], false); goog.addDependency('../../geo/gestalt/client/javascript/dictionary.js', ['ee.Dictionary'], ['ee.ApiFunction', 'ee.ComputedObject', 'ee.Types'], false); diff --git a/javascript/src/ee_api_js.externs.js b/javascript/src/ee_api_js.externs.js index b915bede5..aee3bbaef 100644 --- a/javascript/src/ee_api_js.externs.js +++ b/javascript/src/ee_api_js.externs.js @@ -677,7 +677,7 @@ ee.Image.prototype.getDownloadURL = function(params, opt_callback) { ee.Image.prototype.getInfo = function(opt_callback) { }; /** - * @param {(Object|null)=} opt_visParams + * @param {{bands: (Array|null|string|undefined), bias: (Array|null|number|undefined), format: (string|undefined), gain: (Array|null|number|undefined), gamma: (Array|null|number|undefined), image: (ee.Image|null), max: (Array|null|number|undefined), min: (Array|null|number|undefined), opacity: (number|undefined), palette: (Array|null|string|undefined)}=} opt_visParams * @param {function ((Object|null), string=): ?=} opt_callback * @return {(undefined|{image: (ee.Image|null), mapid: string, token: string})} */ @@ -891,7 +891,7 @@ ee.data.getInfo = function(id, opt_callback) { ee.data.getList = function(params, opt_callback) { }; /** - * @param {(Object|null)} params + * @param {{bands: (Array|null|string|undefined), bias: (Array|null|number|undefined), format: (string|undefined), gain: (Array|null|number|undefined), gamma: (Array|null|number|undefined), image: (ee.Image|null), max: (Array|null|number|undefined), min: (Array|null|number|undefined), opacity: (number|undefined), palette: (Array|null|string|undefined)}} params * @param {function ({mapid: string, token: string}, string=): ?=} opt_callback * @return {(ee.data.RawMapId|null)} */ diff --git a/javascript/src/examples/faq/gettingStarted01.js b/javascript/src/examples/faq/gettingStarted01.js new file mode 100644 index 000000000..1c527746f --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted01.js @@ -0,0 +1,36 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Earth Engine Algorithms' section. + */ + +// placeholded imports +var dem = ee.Image('USGS/SRTMGL1_003'); +var collection1 = ee.ImageCollection('NOAA/DMSP-OLS/NIGHTTIME_LIGHTS'); + +// dummy variables +var image1 = ee.Image(1); +var image2 = ee.Image(2); + +// [START image_add_method] +var image3 = image1.add(image2); +// [END image_add_method] + +// [START ee_algo] +var terrainImage = ee.Algorithms.Terrain(dem); +// [END ee_algo] + +// [START user_function] +var myFunction = function(args) { + // do something + return something; +}; +// [END user_function] + +// dummy function +var aFunction = function(image) { + return image; +}; + +// [START collection_map] +var collection2 = collection1.map(aFunction); +// [END collection_map] diff --git a/javascript/src/examples/faq/gettingStarted02.js b/javascript/src/examples/faq/gettingStarted02.js new file mode 100644 index 000000000..7d021c5d1 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted02.js @@ -0,0 +1,12 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from '"Hello world!" JavaScript' section + */ + +// [START js_hello] +print('Hello world!'); +// [END js_hello] + +// [START ee_hello] +print(ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00')); +// [END ee_hello] diff --git a/javascript/src/examples/faq/gettingStarted03.js b/javascript/src/examples/faq/gettingStarted03.js new file mode 100644 index 000000000..b01d7ec60 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted03.js @@ -0,0 +1,23 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Adding data to the map' section + */ + +// [START image_display] +var image = ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00'); +Map.centerObject(image, 9); +Map.addLayer(image); +// [END image_display] + +// [START image_visualization] +var image = ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00'); +// define visualization parameters in an object literal +var vizParams = {bands: ['B5', 'B4', 'B3'], min: 5000, max: 15000, gamma: 1.3}; +Map.centerObject(image, 9); +Map.addLayer(image, vizParams, 'Landsat 8 false color'); +// [END image_visualization] + +// [START fc_display] +var counties = ee.FeatureCollection('ft:1S4EB6319wWW2sWQDPhDvmSBIVrD3iEmCLYB7nMM'); +Map.addLayer(counties, {}, 'counties'); +// [END fc_display] diff --git a/javascript/src/examples/faq/gettingStarted04.js b/javascript/src/examples/faq/gettingStarted04.js new file mode 100644 index 000000000..10432b8d6 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted04.js @@ -0,0 +1,38 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Finding ImageCollections and FeatureCollections' and + * 'Filtering and Sorting' sections + */ + +// [START collection_load] +var collection = ee.ImageCollection('LANDSAT/LC8_L1T'); +// [END collection_load] +print(collection.first()); + +// [START make_point] +var point = ee.Geometry.Point(-122.262, 37.8719); +// [END make_point] + +// [START date_range] +var start = ee.Date('2014-06-01'); +var finish = ee.Date('2014-10-01'); +// [END date_range] + +// [START filter_ic] +var filteredCollection = ee.ImageCollection('LANDSAT/LC8_L1T') + .filterBounds(point) + .filterDate(start, finish) + .sort('CLOUD_COVER', true); +// [END filter_ic] +print(filteredCollection); + +// [START get_first] +var first = filteredCollection.first(); +// [END get_first] +print(first); + +// [START filter_fc] +var featureCollection = ee.FeatureCollection('ft:1fRY18cjsHzDgGiJiS2nnpUU3v9JPDc2HNaR7Xk8'); +var filteredFC = featureCollection.filter(ee.Filter.eq('Name', 'California')); +Map.addLayer(filteredFC, {}, 'California'); +// [END filter_fc] diff --git a/javascript/src/examples/faq/gettingStarted05.js b/javascript/src/examples/faq/gettingStarted05.js new file mode 100644 index 000000000..1fb6680ea --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted05.js @@ -0,0 +1,37 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Band Math' and 'Masking' sections + */ + +// [START band_math] +// function to get NDVI from Landsat 5 imagery +var getNDVI = function(image) { + return image.normalizedDifference(['B4', 'B3']); +}; + +// two Landsat 5 images, 20 years apart +var image1 = ee.Image('LT5_L1T_TOA/LT50440341990155XXX03'); +var image2 = ee.Image('LT5_L1T_TOA/LT50440342010162EDC00'); + +// compute NDVI from the scenes +var ndvi1 = getNDVI(image1); +var ndvi2 = getNDVI(image2); + +// compute the difference in NDVI +var ndviDifference = ndvi2.subtract(ndvi1); +// [END band_math] + +// [START masking] + +// land mask from the SRTM DEM +var landMask = ee.Image('CGIAR/SRTM90_V4').mask(); +// combine the land mask with the original image mask +var mask = ndviDifference.mask().and(landMask); +// apply the mask to the NDVI difference +var maskedDifference = ndviDifference.mask(mask); + +// display the masked result +var vizParams = {min: -0.5, max: 0.5, palette: ['FF0000', 'FFFFFF', '0000FF']}; +Map.setCenter(-122.2531, 37.6295, 9); +Map.addLayer(maskedDifference, vizParams, 'NDVI difference'); +// [END masking] diff --git a/javascript/src/examples/faq/gettingStarted06.js b/javascript/src/examples/faq/gettingStarted06.js new file mode 100644 index 000000000..4f03eac1b --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted06.js @@ -0,0 +1,24 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Mapping (what to do instead of a for-loop)' section + */ + +// [START map_function] +// function to get NDVI from Landsat 8 imagery +var addNDVI = function(image) { + return image.addBands(image.normalizedDifference(['B5', 'B4'])); +}; + +// load the Landsat 8 raw data, filter by location and date +var collection = ee.ImageCollection('LANDSAT/LC8_L1T') + .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) + .filterDate('2014-06-01', '2014-10-01'); + +// map the function over the collection +var ndviCollection = collection.map(addNDVI); +// [END map_function] + +// display the result +var vizParams = {bands: ['nd'], min: -0.5, max: 1, palette: ['FF0000', '00FF00']}; +var image = ee.Image(ndviCollection.mosaic()); +Map.addLayer(image, vizParams, 'NDVI'); diff --git a/javascript/src/examples/faq/gettingStarted07.js b/javascript/src/examples/faq/gettingStarted07.js new file mode 100644 index 000000000..93da1ae28 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted07.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Mapping (what to do instead of a for-loop)' section + */ + +// [START property_compute] +// function to compute a new property from existing properties +var addField = function(feature) { + var p3 = ee.Number(feature.get('property1')).add(feature.get('property2')); + return feature.set({'property3': p3}); +}; + +// create a FeatureCollection from a list of Features +var features = ee.FeatureCollection([ + ee.Feature(ee.Geometry.Point(-122.4536, 37.7403), + {property1: 100, property2: 100}), + ee.Feature(ee.Geometry.Point(-118.2294, 34.039), + {property1: 200, property2: 300}), +]); + +// map the function over the collection +var featureCollection = features.map(addField); +// [END property_compute] + +// print the FeatureCollection +print(featureCollection); diff --git a/javascript/src/examples/faq/gettingStarted08.js b/javascript/src/examples/faq/gettingStarted08.js new file mode 100644 index 000000000..c6d0d5e77 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted08.js @@ -0,0 +1,21 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Mapping (what to do instead of a for-loop)' section + */ + +// [START convert_collection] +// function to get the image centroid +var getGeom = function(image) { + return ee.Feature(image.geometry().centroid(), {foo: 1}); +}; + +// Landsat 8 collection +var collection = ee.ImageCollection('LANDSAT/LC8_L1T') + .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) + .filterDate('2014-06-01', '2014-10-01'); + +// map the function over the ImageCollection +var featureCollection = ee.FeatureCollection(collection.map(getGeom)); +// [END convert_collection] + +print(featureCollection); diff --git a/javascript/src/examples/faq/gettingStarted09.js b/javascript/src/examples/faq/gettingStarted09.js new file mode 100644 index 000000000..12dadade2 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted09.js @@ -0,0 +1,21 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Reducing' section + */ + +// [START temporal_reduce] +// load a Landsat 8 collection, sort by increasing cloudiness +var collection = ee.ImageCollection('LANDSAT/LC8_L1T') + .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) + .filterDate('2014-01-01', '2014-12-31') + .sort('CLOUD_COVER'); + +// median in each pixel, each band of the 5 least cloudy scenes +var median = collection.limit(5).reduce(ee.Reducer.median()); +// [END temporal_reduce] + +// display +var vizParams = { + bands: ['B5_median', 'B4_median', 'B3_median'], min: 5000, max: 15000 +}; +Map.addLayer(median, vizParams, 'median false color'); diff --git a/javascript/src/examples/faq/gettingStarted10.js b/javascript/src/examples/faq/gettingStarted10.js new file mode 100644 index 000000000..a484e6988 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted10.js @@ -0,0 +1,23 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Reducing' section + */ + +// [START spatial_reduce] +// load and display a precomputed NDVI composite +var ndviImage = ee.Image('LANDSAT/LC8_L1T_ANNUAL_NDVI/2014'); +Map.addLayer(ndviImage); + +// create an arbitrary rectangle as a region, display +var region = ee.Geometry.Rectangle(-122.0828, 36.9631, -121.7807, 37.2303); +Map.addLayer(region); + +// get a dictionary of means in the region, keys are bandnames +var mean = ndviImage.reduceRegion({ + reducer: ee.Reducer.mean(), + geometry: region, + scale: 30 +}); +// [END spatial_reduce] + +print('mean NDVI:', mean); diff --git a/javascript/src/examples/faq/gettingStarted11.js b/javascript/src/examples/faq/gettingStarted11.js new file mode 100644 index 000000000..2fbca9101 --- /dev/null +++ b/javascript/src/examples/faq/gettingStarted11.js @@ -0,0 +1,43 @@ +/** + * @fileoverview Earth Engine Developer's Guide examples + * from 'Masking' section + */ + +// [START cloud_masking] +// function to get NDVI from a Landsat 8 image +var addNDVI = function(image) { + return image.addBands(image.normalizedDifference(['B5', 'B4'])); +}; + +// function to mask cloudy pixels +var cloudMask = function(image) { + var clouds = ee.Algorithms.Landsat.simpleCloudScore(image).select(['cloud']); + return image.mask(clouds.lt(10)); +}; + +// load a Landsat collection, map the NDVI and cloud masking functions over it +var collection = ee.ImageCollection('LANDSAT/LC8_L1T_TOA') + .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) + .filterDate('2014-03-01', '2014-05-31') + .map(addNDVI) + .map(cloudMask); + +// reduce the collection to the mean in each pixel, display +var meanImage = collection.reduce(ee.Reducer.mean()); +var vizParams = {bands: ['B5_mean', 'B4_mean', 'B3_mean'], min: 0, max: 0.5}; +Map.addLayer(meanImage, vizParams, 'mean'); + +// load a region in which to compute the mean, display +var counties = ee.FeatureCollection ('ft:1S4EB6319wWW2sWQDPhDvmSBIVrD3iEmCLYB7nMM'); +var santacruz = ee.Feature(counties.filterMetadata('FIPS', 'equals', 6087).first()); +Map.addLayer(santacruz); + +// get the mean of NDVI in the region +var mean = meanImage.select(['nd_mean']).reduceRegion({ + reducer: ee.Reducer.mean(), + geometry: santacruz.geometry(), + scale: 30 +}); +// [END cloud_masking] + +print('Santa Cruz spring mean NDVI:', mean); diff --git a/javascript/src/image.js b/javascript/src/image.js index 388928f51..9303940f9 100644 --- a/javascript/src/image.js +++ b/javascript/src/image.js @@ -152,8 +152,8 @@ ee.Image.prototype.getInfo = function(opt_callback) { * An imperative function that returns a map id and token, suitable for * generating a Map overlay. * - * @param {Object?=} opt_visParams The visualization parameters. - * See ee.data.getMapId. + * @param {ee.data.ImageVisualizationParameters=} opt_visParams + * The visualization parameters. * @param {function(Object, string=)=} opt_callback An async callback. * @return {ee.data.MapId|undefined} An object containing a mapid string, an * access token plus this object, or an error message. Or undefined if a @@ -161,7 +161,8 @@ ee.Image.prototype.getInfo = function(opt_callback) { * @export */ ee.Image.prototype.getMap = function(opt_visParams, opt_callback) { - var request = opt_visParams ? goog.object.clone(opt_visParams) : {}; + var request = /** @type {ee.data.ImageVisualizationParameters} */ ( + opt_visParams ? goog.object.clone(opt_visParams) : {}); request['image'] = this.serialize(); if (opt_callback) { diff --git a/python/ee/__init__.py b/python/ee/__init__.py index 3d3f60256..b7d48b885 100644 --- a/python/ee/__init__.py +++ b/python/ee/__init__.py @@ -2,7 +2,7 @@ """The EE Javascript library.""" -__version__ = '0.1.54' +__version__ = '0.1.55' # Using lowercase function naming to match the JavaScript names. # pylint: disable=g-bad-name diff --git a/python/ee/data.py b/python/ee/data.py index b1f62e5b1..a0603be6a 100644 --- a/python/ee/data.py +++ b/python/ee/data.py @@ -9,7 +9,6 @@ import json import urllib -import deprecation import ee_exception import httplib2 @@ -88,7 +87,6 @@ def setDeadline(milliseconds): _deadline_ms = milliseconds -@deprecation.Deprecated('Use ee.data.getValue()') def getInfo(asset_id): """Load info for an asset, given an asset id.