@allmaps/transform
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
@@ -1,3 +0,3 @@ | ||
// https://allmaps.org v1.0.0-alpha.4 Copyright 2021 Bert Spaan | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).allmaps={})}(this,(function(t){"use strict";const r=Number.POSITIVE_INFINITY,e="PARAMETER ERROR",n="INTERNAL ERROR",o="NOT SOLVABLE",i="NOT ENOUGH POINTS";class s{constructor(t,r,e,n){this.dfGCPPixel=t,this.dfGCPLine=r,this.dfGCPX=e,this.dfGCPY=n}}class a{}class f{constructor(){this.adfToGeoX=[],this.adfToGeoY=[],this.adfFromGeoX=[],this.adfFromGeoY=[]}}class u{constructor(t=0){this.n=t,this.v=[]}getM(t,r){return this.v[(t-1)*this.n+r-1]}setM(t,r,e){this.v[(t-1)*this.n+r-1]=e}}function c(t,r,n){return function(t,r,n,o,i,s){const u=t.length;let c=new a,d=0,h=0,M=0,m=0;0===r&&(r=u>=10||u>=6?2:1);const w=new f;if(w.bReversed=n,w.nOrder=r,w.bRefine=o,w.dfTolerance=i,w.nMinimumGcps=s,w.nRefCount=1,w.pasGCPList=t,w.nGCPCount=u,0===u)throw new Error("NOT ENOUGH POINTS");if(o)throw new Error("remove_outliers not implemented");{let n=[],o=[],i=[],s=[],a=[];for(let r=0;r<u;r++)a[r]=1,n[r]=t[r].dfGCPX,o[r]=t[r].dfGCPY,i[r]=t[r].dfGCPPixel,s[r]=t[r].dfGCPLine,d+=t[r].dfGCPPixel,h+=t[r].dfGCPLine,M+=t[r].dfGCPX,m+=t[r].dfGCPY;w.x1Mean=d/u,w.y1Mean=h/u,w.x2Mean=M/u,w.y2Mean=m/u,c.count=u,c.e1=i,c.n1=s,c.e2=n,c.n2=o,c.status=a,function(t,r,n,o,i,s,a){let f;if(a<1||a>3)throw new Error(e);l(r,t.x1Mean,t.y1Mean,n,o,a),f=r.e1,r.e1=r.e2,r.e2=f,f=r.n1,r.n1=r.n2,r.n2=f,l(r,t.x2Mean,t.y2Mean,i,s,a),f=r.e1,r.e1=r.e2,r.e2=f,f=r.n1,r.n1=r.n2,r.n2=f}(w,c,w.adfToGeoX,w.adfToGeoY,w.adfFromGeoX,w.adfFromGeoY,r)}return w}(t,r,n,!1,-1,-1)}function l(t,r,e,o,s,a){const f=new u,c=[],l=[];let M=0,m=0;for(m=M=0;m<t.count;m++)t.status[m]>0&&M++;if(f.n=(a+1)*(a+2)/2,M<f.n)throw new Error(i);f.v=[],M===f.n?function(t,r,e,o,i,s,a,f){let u=1;for(let n=0;n<t.count;n++)if(t.status[n]>0){for(let i=1;i<=r.n;i++)r.setM(u,i,h(i,t.e1[n]-e,t.n1[n]-o));i[u-1]=t.e2[n],s[u-1]=t.n2[n],u++}if(u-1!==r.n)throw new Error(n);d(r,i,s,a,f)}(t,f,r,e,c,l,o,s):function(t,r,e,o,i,s,a,f){let u=0;for(let t=1;t<=r.n;t++){for(let e=t;e<=r.n;e++)r.setM(t,e,0);i[t-1]=s[t-1]=0}for(let n=0;n<t.count;n++)if(t.status[n]>0){u++;for(let a=1;a<=r.n;a++){for(let i=a;i<=r.n;i++)r.setM(a,i,r.getM(a,i)+h(a,t.e1[n]-e,t.n1[n]-o)*h(i,t.e1[n]-e,t.n1[n]-o));i[a-1]+=t.e2[n]*h(a,t.e1[n]-e,t.n1[n]-o),s[a-1]+=t.n2[n]*h(a,t.e1[n]-e,t.n1[n]-o)}}if(u<=r.n)throw new Error(n);for(let t=2;t<=r.n;t++)for(let e=1;e<t;e++)r.setM(t,e,r.getM(e,t));d(r,i,s,a,f)}(t,f,r,e,c,l,o,s)}function d(t,r,e,n,i){for(let n=1;n<=t.n;n++){let i=n,s=t.getM(n,i),a=n;for(let r=n+1;r<=t.n;r++)Math.abs(t.getM(r,i))>Math.abs(s)&&(s=t.getM(r,i),a=r);if(0===s)throw new Error(o);if(a!==n){for(let r=1;r<=t.n;r++){const e=t.getM(a,r),o=t.getM(n,r);t.setM(a,r,o),t.setM(n,r,e)}const o=r[a-1],i=r[n-1];r[n-1]=o,r[a-1]=i;const s=e[a-1],f=e[n-1];e[a-1]=f,e[n-1]=s}for(let o=1;o<=t.n;o++)if(o!==n){const a=t.getM(o,i)/s;for(let r=i;r<=t.n;r++){const e=a*t.getM(n,r);t.setM(o,r,t.getM(o,r)-e)}r[o-1]-=a*r[n-1],e[o-1]-=a*e[n-1]}}for(let o=1;o<=t.n;o++)n[o-1]=r[o-1]/t.getM(o,o),i[o-1]=e[o-1]/t.getM(o,o)}function h(t,r,e){switch(t){case 1:return 1;case 2:return r;case 3:return e;case 4:return r*r;case 5:return r*e;case 6:return e*e;case 7:return r*r*r;case 8:return r*r*e;case 9:return r*e*e;case 10:return e*e*e}return 0}function M(t,e,n){const o=n.length,i=t,s=[];i.bReversed&&(e=!e);for(let t=0;t<o;t++){if(n[t].x===r||n[t].y===r)throw new Error("HUGE_VAL");let o;o=e?m(n[t].x-i.x2Mean,n[t].y-i.y2Mean,i.adfFromGeoX,i.adfFromGeoY,i.nOrder):m(n[t].x-i.x1Mean,n[t].y-i.y1Mean,i.adfToGeoX,i.adfToGeoY,i.nOrder),s[t]={x:o[0],y:o[1]}}return s}function m(t,r,n,o,i){let s,a,f=0,u=0,c=0,l=0,d=0,h=0,M=0;if(1===i)return s=n[0]+n[1]*t+n[2]*r,a=o[0]+o[1]*t+o[2]*r,[s,a];if(2===i)return d=t*t,M=r*r,h=t*r,s=n[0]+n[1]*t+n[2]*r+n[3]*d+n[4]*h+n[5]*M,a=o[0]+o[1]*t+o[2]*r+o[3]*d+o[4]*h+o[5]*M,[s,a];if(3===i)return d=t*t,h=t*r,M=r*r,f=t*d,u=d*r,c=t*M,l=r*M,s=n[0]+n[1]*t+n[2]*r+n[3]*d+n[4]*h+n[5]*M+n[6]*f+n[7]*u+n[8]*c+n[9]*l,a=o[0]+o[1]*t+o[2]*r+o[3]*d+o[4]*h+o[5]*M+o[6]*f+o[7]*u+o[8]*c+o[9]*l,[s,a];throw new Error(e)}function w(t,r){const e=M(t,!1,[{x:r[0],y:r[1]}]);return[e[0].y,e[0].x]}var y=6371008.8,g={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*y,kilometers:6371.0088,kilometres:6371.0088,meters:y,metres:y,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:y/1852,radians:1,yards:5825721.287490856};function G(t){return 180*(t%(2*Math.PI))/Math.PI}function p(t){return t%360*Math.PI/180}function P(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function E(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function v(t,r,e){if(void 0===e&&(e={}),!0===e.final)return function(t,r){var e=v(r,t);return e=(e+180)%360}(t,r);var n=E(t),o=E(r),i=p(n[0]),s=p(o[0]),a=p(n[1]),f=p(o[1]),u=Math.sin(s-i)*Math.cos(f),c=Math.cos(a)*Math.sin(f)-Math.sin(a)*Math.cos(f)*Math.cos(s-i);return G(Math.atan2(u,c))}function x(t,r,e,n){void 0===n&&(n={});var o=E(t),i=p(o[0]),s=p(o[1]),a=p(e),f=function(t,r){void 0===r&&(r="kilometers");var e=g[r];if(!e)throw new Error(r+" units is invalid");return t/e}(r,n.units),u=Math.asin(Math.sin(s)*Math.cos(f)+Math.cos(s)*Math.sin(f)*Math.cos(a));return function(t,r,e){if(void 0===e&&(e={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!P(t[0])||!P(t[1]))throw new Error("coordinates must contain numbers");return function(t,r,e){void 0===e&&(e={});var n={type:"Feature"};return(0===e.id||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=r||{},n.geometry=t,n}({type:"Point",coordinates:t},r,e)}([G(i+Math.atan2(Math.sin(a)*Math.sin(f)*Math.cos(s),Math.cos(f)-Math.sin(s)*Math.sin(u))),G(u)],n.properties)}function b(t,r,e){void 0===e&&(e={});var n=E(t),o=E(r),i=p(o[1]-n[1]),s=p(o[0]-n[0]),a=p(n[1]),f=p(o[1]),u=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(f);return function(t,r){void 0===r&&(r="kilometers");var e=g[r];if(!e)throw new Error(r+" units is invalid");return t*e}(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),e.units)}function A(t){return{type:"Point",coordinates:t}}function T(t,r,e,n,o=0){const i=[(r.from.image[0]+r.to.image[0])/2,(r.from.image[1]+r.to.image[1])/2],s=(a=A(r.from.world),f=A(r.to.world),x(a,b(a,f)/2,v(a,f)));var a,f;const u=A(w(t,i)),c=b(A(r.from.world),A(r.to.world));if(b(s,u)/c>e&&o<n){const n={image:i,world:u.coordinates};return[T(t,{from:r.from,to:n},e,o+1),T(t,{from:n,to:r.to},e,o+1)]}return r}t.createTransformer=function(t){return c(t.map((t=>new s(t.image[0],t.image[1],t.world[1],t.world[0]))),0,!1)},t.polygonToWorld=function(t,r,e=.01,n=8){const o=r.map((r=>({image:r,world:w(t,r)}))),i=Array.from(Array(o.length-1)).map(((t,r)=>({from:o[r],to:o[r+1]}))).map((r=>T(t,r,e,n))).flat(1/0);return{type:"Polygon",coordinates:[[i[0].from.world,...i.map((t=>t.to.world))]]}},t.toImage=function(t,r){const e=M(t,!0,[{x:r[1],y:r[0]}]);return[e[0].x,e[0].y]},t.toWorld=w})); | ||
// https://allmaps.org v1.0.0-alpha.5 Copyright 2021 Bert Spaan | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).allmaps={})}(this,(function(t){"use strict";const r=Number.POSITIVE_INFINITY,e="PARAMETER ERROR",n="INTERNAL ERROR",o="NOT SOLVABLE",i="NOT ENOUGH POINTS";class s{constructor(t,r,e,n){this.dfGCPPixel=t,this.dfGCPLine=r,this.dfGCPX=e,this.dfGCPY=n}}class a{}class f{constructor(){this.adfToGeoX=[],this.adfToGeoY=[],this.adfFromGeoX=[],this.adfFromGeoY=[]}}class u{constructor(t=0){this.n=t,this.v=[]}getM(t,r){return this.v[(t-1)*this.n+r-1]}setM(t,r,e){this.v[(t-1)*this.n+r-1]=e}}function c(t,r,n){return function(t,r,n,o,i,s){const u=t.length;let c=new a,d=0,h=0,M=0,m=0;r=1;const w=new f;if(w.bReversed=n,w.nOrder=r,w.bRefine=o,w.dfTolerance=i,w.nMinimumGcps=s,w.nRefCount=1,w.pasGCPList=t,w.nGCPCount=u,0===u)throw new Error("NOT ENOUGH POINTS");if(o)throw new Error("remove_outliers not implemented");{let n=[],o=[],i=[],s=[],a=[];for(let r=0;r<u;r++)a[r]=1,n[r]=t[r].dfGCPX,o[r]=t[r].dfGCPY,i[r]=t[r].dfGCPPixel,s[r]=t[r].dfGCPLine,d+=t[r].dfGCPPixel,h+=t[r].dfGCPLine,M+=t[r].dfGCPX,m+=t[r].dfGCPY;w.x1Mean=d/u,w.y1Mean=h/u,w.x2Mean=M/u,w.y2Mean=m/u,c.count=u,c.e1=i,c.n1=s,c.e2=n,c.n2=o,c.status=a,function(t,r,n,o,i,s,a){let f;if(a<1||a>3)throw new Error(e);l(r,t.x1Mean,t.y1Mean,n,o,a),f=r.e1,r.e1=r.e2,r.e2=f,f=r.n1,r.n1=r.n2,r.n2=f,l(r,t.x2Mean,t.y2Mean,i,s,a),f=r.e1,r.e1=r.e2,r.e2=f,f=r.n1,r.n1=r.n2,r.n2=f}(w,c,w.adfToGeoX,w.adfToGeoY,w.adfFromGeoX,w.adfFromGeoY,r)}return w}(t,r,n,!1,-1,-1)}function l(t,r,e,o,s,a){const f=new u,c=[],l=[];let M=0,m=0;for(m=M=0;m<t.count;m++)t.status[m]>0&&M++;if(f.n=(a+1)*(a+2)/2,M<f.n)throw new Error(i);f.v=[],M===f.n?function(t,r,e,o,i,s,a,f){let u=1;for(let n=0;n<t.count;n++)if(t.status[n]>0){for(let i=1;i<=r.n;i++)r.setM(u,i,h(i,t.e1[n]-e,t.n1[n]-o));i[u-1]=t.e2[n],s[u-1]=t.n2[n],u++}if(u-1!==r.n)throw new Error(n);d(r,i,s,a,f)}(t,f,r,e,c,l,o,s):function(t,r,e,o,i,s,a,f){let u=0;for(let t=1;t<=r.n;t++){for(let e=t;e<=r.n;e++)r.setM(t,e,0);i[t-1]=s[t-1]=0}for(let n=0;n<t.count;n++)if(t.status[n]>0){u++;for(let a=1;a<=r.n;a++){for(let i=a;i<=r.n;i++)r.setM(a,i,r.getM(a,i)+h(a,t.e1[n]-e,t.n1[n]-o)*h(i,t.e1[n]-e,t.n1[n]-o));i[a-1]+=t.e2[n]*h(a,t.e1[n]-e,t.n1[n]-o),s[a-1]+=t.n2[n]*h(a,t.e1[n]-e,t.n1[n]-o)}}if(u<=r.n)throw new Error(n);for(let t=2;t<=r.n;t++)for(let e=1;e<t;e++)r.setM(t,e,r.getM(e,t));d(r,i,s,a,f)}(t,f,r,e,c,l,o,s)}function d(t,r,e,n,i){for(let n=1;n<=t.n;n++){let i=n,s=t.getM(n,i),a=n;for(let r=n+1;r<=t.n;r++)Math.abs(t.getM(r,i))>Math.abs(s)&&(s=t.getM(r,i),a=r);if(0===s)throw new Error(o);if(a!==n){for(let r=1;r<=t.n;r++){const e=t.getM(a,r),o=t.getM(n,r);t.setM(a,r,o),t.setM(n,r,e)}const o=r[a-1],i=r[n-1];r[n-1]=o,r[a-1]=i;const s=e[a-1],f=e[n-1];e[a-1]=f,e[n-1]=s}for(let o=1;o<=t.n;o++)if(o!==n){const a=t.getM(o,i)/s;for(let r=i;r<=t.n;r++){const e=a*t.getM(n,r);t.setM(o,r,t.getM(o,r)-e)}r[o-1]-=a*r[n-1],e[o-1]-=a*e[n-1]}}for(let o=1;o<=t.n;o++)n[o-1]=r[o-1]/t.getM(o,o),i[o-1]=e[o-1]/t.getM(o,o)}function h(t,r,e){switch(t){case 1:return 1;case 2:return r;case 3:return e;case 4:return r*r;case 5:return r*e;case 6:return e*e;case 7:return r*r*r;case 8:return r*r*e;case 9:return r*e*e;case 10:return e*e*e}return 0}function M(t,e,n){const o=n.length,i=t,s=[];i.bReversed&&(e=!e);for(let t=0;t<o;t++){if(n[t].x===r||n[t].y===r)throw new Error("HUGE_VAL");let o;o=e?m(n[t].x-i.x2Mean,n[t].y-i.y2Mean,i.adfFromGeoX,i.adfFromGeoY,i.nOrder):m(n[t].x-i.x1Mean,n[t].y-i.y1Mean,i.adfToGeoX,i.adfToGeoY,i.nOrder),s[t]={x:o[0],y:o[1]}}return s}function m(t,r,n,o,i){let s,a,f=0,u=0,c=0,l=0,d=0,h=0,M=0;if(1===i)return s=n[0]+n[1]*t+n[2]*r,a=o[0]+o[1]*t+o[2]*r,[s,a];if(2===i)return d=t*t,M=r*r,h=t*r,s=n[0]+n[1]*t+n[2]*r+n[3]*d+n[4]*h+n[5]*M,a=o[0]+o[1]*t+o[2]*r+o[3]*d+o[4]*h+o[5]*M,[s,a];if(3===i)return d=t*t,h=t*r,M=r*r,f=t*d,u=d*r,c=t*M,l=r*M,s=n[0]+n[1]*t+n[2]*r+n[3]*d+n[4]*h+n[5]*M+n[6]*f+n[7]*u+n[8]*c+n[9]*l,a=o[0]+o[1]*t+o[2]*r+o[3]*d+o[4]*h+o[5]*M+o[6]*f+o[7]*u+o[8]*c+o[9]*l,[s,a];throw new Error(e)}function w(t,r){const e=M(t,!1,[{x:r[0],y:r[1]}]);return[e[0].y,e[0].x]}var y=6371008.8,g={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*y,kilometers:6371.0088,kilometres:6371.0088,meters:y,metres:y,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:y/1852,radians:1,yards:5825721.287490856};function G(t){return 180*(t%(2*Math.PI))/Math.PI}function p(t){return t%360*Math.PI/180}function P(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function E(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function v(t,r,e){if(void 0===e&&(e={}),!0===e.final)return function(t,r){var e=v(r,t);return e=(e+180)%360}(t,r);var n=E(t),o=E(r),i=p(n[0]),s=p(o[0]),a=p(n[1]),f=p(o[1]),u=Math.sin(s-i)*Math.cos(f),c=Math.cos(a)*Math.sin(f)-Math.sin(a)*Math.cos(f)*Math.cos(s-i);return G(Math.atan2(u,c))}function x(t,r,e,n){void 0===n&&(n={});var o=E(t),i=p(o[0]),s=p(o[1]),a=p(e),f=function(t,r){void 0===r&&(r="kilometers");var e=g[r];if(!e)throw new Error(r+" units is invalid");return t/e}(r,n.units),u=Math.asin(Math.sin(s)*Math.cos(f)+Math.cos(s)*Math.sin(f)*Math.cos(a));return function(t,r,e){if(void 0===e&&(e={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!P(t[0])||!P(t[1]))throw new Error("coordinates must contain numbers");return function(t,r,e){void 0===e&&(e={});var n={type:"Feature"};return(0===e.id||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=r||{},n.geometry=t,n}({type:"Point",coordinates:t},r,e)}([G(i+Math.atan2(Math.sin(a)*Math.sin(f)*Math.cos(s),Math.cos(f)-Math.sin(s)*Math.sin(u))),G(u)],n.properties)}function b(t,r,e){void 0===e&&(e={});var n=E(t),o=E(r),i=p(o[1]-n[1]),s=p(o[0]-n[0]),a=p(n[1]),f=p(o[1]),u=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(f);return function(t,r){void 0===r&&(r="kilometers");var e=g[r];if(!e)throw new Error(r+" units is invalid");return t*e}(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),e.units)}function A(t){return{type:"Point",coordinates:t}}function T(t,r,e,n,o=0){const i=[(r.from.image[0]+r.to.image[0])/2,(r.from.image[1]+r.to.image[1])/2],s=(a=A(r.from.world),f=A(r.to.world),x(a,b(a,f)/2,v(a,f)));var a,f;const u=A(w(t,i)),c=b(A(r.from.world),A(r.to.world));if(b(s,u)/c>e&&o<n){const n={image:i,world:u.coordinates};return[T(t,{from:r.from,to:n},e,o+1),T(t,{from:n,to:r.to},e,o+1)]}return r}t.createTransformer=function(t){return c(t.map((t=>new s(t.image[0],t.image[1],t.world[1],t.world[0]))),0,!1)},t.polygonToWorld=function(t,r,e=.01,n=8){const o=r.map((r=>({image:r,world:w(t,r)}))),i=Array.from(Array(o.length-1)).map(((t,r)=>({from:o[r],to:o[r+1]}))).map((r=>T(t,r,e,n))).flat(1/0);return{type:"Polygon",coordinates:[[i[0].from.world,...i.map((t=>t.to.world))]]}},t.toImage=function(t,r){const e=M(t,!0,[{x:r[1],y:r[0]}]);return[e[0].x,e[0].y]},t.toWorld=w})); | ||
//# sourceMappingURL=allmaps-transform.min.js.map |
@@ -104,13 +104,19 @@ 'use strict'; | ||
if (nReqOrder === 0) { | ||
if (nGCPCount >= 10) { | ||
// for now we avoid 3rd order since it is unstable | ||
nReqOrder = 2; | ||
} else if (nGCPCount >= 6) { | ||
nReqOrder = 2; | ||
} else { | ||
nReqOrder = 1; | ||
} | ||
} | ||
// if (nReqOrder === 0) { | ||
// if (nGCPCount >= 10) { | ||
// // for now we avoid 3rd order since it is unstable | ||
// nReqOrder = 2 | ||
// } else if (nGCPCount >= 6) { | ||
// nReqOrder = 2 | ||
// } else { | ||
// nReqOrder = 1 | ||
// } | ||
// } | ||
// TODO: the code above that sets nReqOrder comes from GDAL | ||
// this can lead to unwanted and unpredictable results | ||
// in the future, nReqOrder can maybe be selected by the user | ||
// for now, always set nReqOrder to 1 | ||
nReqOrder = 1; | ||
const psInfo = new GCPTransformInfo(); | ||
@@ -117,0 +123,0 @@ psInfo.bReversed = bReversed; |
@@ -100,13 +100,19 @@ const HUGE_VAL = Number.POSITIVE_INFINITY; | ||
if (nReqOrder === 0) { | ||
if (nGCPCount >= 10) { | ||
// for now we avoid 3rd order since it is unstable | ||
nReqOrder = 2; | ||
} else if (nGCPCount >= 6) { | ||
nReqOrder = 2; | ||
} else { | ||
nReqOrder = 1; | ||
} | ||
} | ||
// if (nReqOrder === 0) { | ||
// if (nGCPCount >= 10) { | ||
// // for now we avoid 3rd order since it is unstable | ||
// nReqOrder = 2 | ||
// } else if (nGCPCount >= 6) { | ||
// nReqOrder = 2 | ||
// } else { | ||
// nReqOrder = 1 | ||
// } | ||
// } | ||
// TODO: the code above that sets nReqOrder comes from GDAL | ||
// this can lead to unwanted and unpredictable results | ||
// in the future, nReqOrder can maybe be selected by the user | ||
// for now, always set nReqOrder to 1 | ||
nReqOrder = 1; | ||
const psInfo = new GCPTransformInfo(); | ||
@@ -113,0 +119,0 @@ psInfo.bReversed = bReversed; |
{ | ||
"name": "@allmaps/transform", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Bert Spaan", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
309371
1840