dgeoutils 2.4.19 → 2.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DPoint.d.ts +4 -0
- package/dist/cjs/DPoint.js +6 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/utils.d.ts +2 -0
- package/dist/cjs/utils.js +55 -1
- package/dist/es2015/DPoint.js +7 -1
- package/dist/es2015/index.js +1 -1
- package/dist/es2015/utils.js +30 -0
- package/dist/esm/DPoint.js +7 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/utils.js +52 -0
- package/dist/umd/dgeoutils.js +60 -1
- package/dist/umd/dgeoutils.min.js +1 -1
- package/dist/umd/dgeoutils.min.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/DPoint.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export declare class DPoint {
|
|
|
34
34
|
static parseFromWKT(wkt: string): DPoint;
|
|
35
35
|
static random(): DPoint;
|
|
36
36
|
static getTileFromQuadKey(quadKey: string): DPoint;
|
|
37
|
+
toDegreesMinutesSeconds(): {
|
|
38
|
+
x: string;
|
|
39
|
+
y: string;
|
|
40
|
+
};
|
|
37
41
|
getTileFromCoords(zoom?: number): DPoint;
|
|
38
42
|
getQuadKeyFromTile(zoom?: number): string;
|
|
39
43
|
getCoordsFromTile(zoom?: number): DPoint;
|
package/dist/cjs/DPoint.js
CHANGED
|
@@ -139,6 +139,12 @@ var DPoint = (function () {
|
|
|
139
139
|
}
|
|
140
140
|
return p;
|
|
141
141
|
};
|
|
142
|
+
DPoint.prototype.toDegreesMinutesSeconds = function () {
|
|
143
|
+
return {
|
|
144
|
+
x: (0, utils_1.toDegreesMinutesSeconds)(this.x),
|
|
145
|
+
y: (0, utils_1.toDegreesMinutesSeconds)(this.y)
|
|
146
|
+
};
|
|
147
|
+
};
|
|
142
148
|
DPoint.prototype.getTileFromCoords = function (zoom) {
|
|
143
149
|
if (zoom === void 0) { zoom = this.z; }
|
|
144
150
|
(0, utils_1.checkFunction)('getTileFromCoords')
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export * from './FastSearch';
|
|
|
7
7
|
export * from './TraceMatrix';
|
|
8
8
|
export * from './DPolygonLoop';
|
|
9
9
|
export * from './DPlane';
|
|
10
|
-
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, getCombinations, DGeo } from './utils';
|
|
10
|
+
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, getCombinations, parseDegreesMinutesSeconds, DGeo } from './utils';
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DGeo = exports.getCombinations = exports.cartesianProduct = exports.isDefAndNotNull = exports.createMatrix = exports.createArray = exports.createCanvas = exports.gaussianElimination = void 0;
|
|
17
|
+
exports.DGeo = exports.parseDegreesMinutesSeconds = exports.getCombinations = exports.cartesianProduct = exports.isDefAndNotNull = exports.createMatrix = exports.createArray = exports.createCanvas = exports.gaussianElimination = void 0;
|
|
18
18
|
__exportStar(require("./DCircle"), exports);
|
|
19
19
|
__exportStar(require("./DLine"), exports);
|
|
20
20
|
__exportStar(require("./DNumbers"), exports);
|
|
@@ -32,4 +32,5 @@ Object.defineProperty(exports, "createMatrix", { enumerable: true, get: function
|
|
|
32
32
|
Object.defineProperty(exports, "isDefAndNotNull", { enumerable: true, get: function () { return utils_1.isDefAndNotNull; } });
|
|
33
33
|
Object.defineProperty(exports, "cartesianProduct", { enumerable: true, get: function () { return utils_1.cartesianProduct; } });
|
|
34
34
|
Object.defineProperty(exports, "getCombinations", { enumerable: true, get: function () { return utils_1.getCombinations; } });
|
|
35
|
+
Object.defineProperty(exports, "parseDegreesMinutesSeconds", { enumerable: true, get: function () { return utils_1.parseDegreesMinutesSeconds; } });
|
|
35
36
|
Object.defineProperty(exports, "DGeo", { enumerable: true, get: function () { return utils_1.DGeo; } });
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -44,4 +44,6 @@ export declare const cartesianProduct: {
|
|
|
44
44
|
};
|
|
45
45
|
export declare const getCombinations: <T>(arr: T[][]) => T[][];
|
|
46
46
|
export declare const div: (a: number, b: number) => number;
|
|
47
|
+
export declare const toDegreesMinutesSeconds: (v: number) => string;
|
|
48
|
+
export declare const parseDegreesMinutesSeconds: (i: string) => number;
|
|
47
49
|
export {};
|
package/dist/cjs/utils.js
CHANGED
|
@@ -24,8 +24,19 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
24
24
|
}
|
|
25
25
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
26
|
};
|
|
27
|
+
var __values = (this && this.__values) || function(o) {
|
|
28
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
29
|
+
if (m) return m.call(o);
|
|
30
|
+
if (o && typeof o.length === "number") return {
|
|
31
|
+
next: function () {
|
|
32
|
+
if (o && i >= o.length) o = void 0;
|
|
33
|
+
return { value: o && o[i++], done: !o };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
37
|
+
};
|
|
27
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.div = exports.getCombinations = exports.cartesianProduct = exports.createCanvas = exports.gaussianElimination = exports.createMatrix = exports.createArray = exports.checkFunction = exports.isDefAndNotNull = exports.warn = exports.DGeo = void 0;
|
|
39
|
+
exports.parseDegreesMinutesSeconds = exports.toDegreesMinutesSeconds = exports.div = exports.getCombinations = exports.cartesianProduct = exports.createCanvas = exports.gaussianElimination = exports.createMatrix = exports.createArray = exports.checkFunction = exports.isDefAndNotNull = exports.warn = exports.DGeo = void 0;
|
|
29
40
|
var DPoint_1 = require("./DPoint");
|
|
30
41
|
exports.DGeo = {
|
|
31
42
|
DEBUG: false,
|
|
@@ -223,3 +234,46 @@ var getCombinations = function (arr) {
|
|
|
223
234
|
exports.getCombinations = getCombinations;
|
|
224
235
|
var div = function (a, b) { return Math.floor(a / b); };
|
|
225
236
|
exports.div = div;
|
|
237
|
+
var toDegreesMinutesSeconds = function (v) {
|
|
238
|
+
var degrees = Math.floor(v);
|
|
239
|
+
var t = (v % 1) * 60;
|
|
240
|
+
var minutes = Math.floor(t);
|
|
241
|
+
var t2 = (t % 1) * 60;
|
|
242
|
+
var seconds = t2.toFixed(2);
|
|
243
|
+
return "".concat(degrees, "\u00B0 ").concat(minutes, "' ").concat(seconds, "\"");
|
|
244
|
+
};
|
|
245
|
+
exports.toDegreesMinutesSeconds = toDegreesMinutesSeconds;
|
|
246
|
+
var parseDegreesMinutesSeconds = function (i) {
|
|
247
|
+
var e_1, _a;
|
|
248
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
249
|
+
var parts = i.matchAll(/(?<value>-?\d+(?<tail>\.\d{0,})?)(?<type>°|'|")/gmiu);
|
|
250
|
+
var d = 0;
|
|
251
|
+
var m = 0;
|
|
252
|
+
var s = 0;
|
|
253
|
+
try {
|
|
254
|
+
for (var parts_1 = __values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) {
|
|
255
|
+
var part = parts_1_1.value;
|
|
256
|
+
switch ((_b = part === null || part === void 0 ? void 0 : part.groups) === null || _b === void 0 ? void 0 : _b.type) {
|
|
257
|
+
case '°':
|
|
258
|
+
d = Number((_d = (_c = part === null || part === void 0 ? void 0 : part.groups) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '0');
|
|
259
|
+
break;
|
|
260
|
+
case '\'':
|
|
261
|
+
m = Number((_f = (_e = part === null || part === void 0 ? void 0 : part.groups) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : '0');
|
|
262
|
+
break;
|
|
263
|
+
case '"':
|
|
264
|
+
s = Number((_h = (_g = part === null || part === void 0 ? void 0 : part.groups) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : '0');
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
271
|
+
finally {
|
|
272
|
+
try {
|
|
273
|
+
if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1);
|
|
274
|
+
}
|
|
275
|
+
finally { if (e_1) throw e_1.error; }
|
|
276
|
+
}
|
|
277
|
+
return d + m / 60 + s / 3600;
|
|
278
|
+
};
|
|
279
|
+
exports.parseDegreesMinutesSeconds = parseDegreesMinutesSeconds;
|
package/dist/es2015/DPoint.js
CHANGED
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { DLine } from './DLine';
|
|
13
13
|
import { DPolygon } from './DPolygon';
|
|
14
|
-
import { checkFunction, createArray, DGeo, div, isDefAndNotNull } from './utils';
|
|
14
|
+
import { checkFunction, createArray, DGeo, div, isDefAndNotNull, toDegreesMinutesSeconds } from './utils';
|
|
15
15
|
const diff = 0;
|
|
16
16
|
const radiansPolygon = new DPolygon();
|
|
17
17
|
const pseudoMercatorPolygon = new DPolygon();
|
|
@@ -106,6 +106,12 @@ export class DPoint {
|
|
|
106
106
|
}
|
|
107
107
|
return p;
|
|
108
108
|
}
|
|
109
|
+
toDegreesMinutesSeconds() {
|
|
110
|
+
return {
|
|
111
|
+
x: toDegreesMinutesSeconds(this.x),
|
|
112
|
+
y: toDegreesMinutesSeconds(this.y)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
109
115
|
getTileFromCoords(zoom = this.z) {
|
|
110
116
|
checkFunction('getTileFromCoords')
|
|
111
117
|
.checkArgument('this')
|
package/dist/es2015/index.js
CHANGED
|
@@ -7,4 +7,4 @@ export * from './FastSearch';
|
|
|
7
7
|
export * from './TraceMatrix';
|
|
8
8
|
export * from './DPolygonLoop';
|
|
9
9
|
export * from './DPlane';
|
|
10
|
-
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, getCombinations, DGeo } from './utils';
|
|
10
|
+
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, getCombinations, parseDegreesMinutesSeconds, DGeo } from './utils';
|
package/dist/es2015/utils.js
CHANGED
|
@@ -174,3 +174,33 @@ export const getCombinations = (arr) => {
|
|
|
174
174
|
return ans;
|
|
175
175
|
};
|
|
176
176
|
export const div = (a, b) => Math.floor(a / b);
|
|
177
|
+
export const toDegreesMinutesSeconds = (v) => {
|
|
178
|
+
const degrees = Math.floor(v);
|
|
179
|
+
const t = (v % 1) * 60;
|
|
180
|
+
const minutes = Math.floor(t);
|
|
181
|
+
const t2 = (t % 1) * 60;
|
|
182
|
+
const seconds = t2.toFixed(2);
|
|
183
|
+
return `${degrees}° ${minutes}' ${seconds}"`;
|
|
184
|
+
};
|
|
185
|
+
export const parseDegreesMinutesSeconds = (i) => {
|
|
186
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
187
|
+
const parts = i.matchAll(/(?<value>-?\d+(?<tail>\.\d{0,})?)(?<type>°|'|")/gmiu);
|
|
188
|
+
let d = 0;
|
|
189
|
+
let m = 0;
|
|
190
|
+
let s = 0;
|
|
191
|
+
for (const part of parts) {
|
|
192
|
+
switch ((_a = part === null || part === void 0 ? void 0 : part.groups) === null || _a === void 0 ? void 0 : _a.type) {
|
|
193
|
+
case '°':
|
|
194
|
+
d = Number((_c = (_b = part === null || part === void 0 ? void 0 : part.groups) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : '0');
|
|
195
|
+
break;
|
|
196
|
+
case '\'':
|
|
197
|
+
m = Number((_e = (_d = part === null || part === void 0 ? void 0 : part.groups) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : '0');
|
|
198
|
+
break;
|
|
199
|
+
case '"':
|
|
200
|
+
s = Number((_g = (_f = part === null || part === void 0 ? void 0 : part.groups) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : '0');
|
|
201
|
+
break;
|
|
202
|
+
default:
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return d + m / 60 + s / 3600;
|
|
206
|
+
};
|
package/dist/esm/DPoint.js
CHANGED
|
@@ -38,7 +38,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
38
38
|
};
|
|
39
39
|
import { DLine } from './DLine';
|
|
40
40
|
import { DPolygon } from './DPolygon';
|
|
41
|
-
import { checkFunction, createArray, DGeo, div, isDefAndNotNull } from './utils';
|
|
41
|
+
import { checkFunction, createArray, DGeo, div, isDefAndNotNull, toDegreesMinutesSeconds } from './utils';
|
|
42
42
|
var diff = 0;
|
|
43
43
|
var radiansPolygon = new DPolygon();
|
|
44
44
|
var pseudoMercatorPolygon = new DPolygon();
|
|
@@ -136,6 +136,12 @@ var DPoint = (function () {
|
|
|
136
136
|
}
|
|
137
137
|
return p;
|
|
138
138
|
};
|
|
139
|
+
DPoint.prototype.toDegreesMinutesSeconds = function () {
|
|
140
|
+
return {
|
|
141
|
+
x: toDegreesMinutesSeconds(this.x),
|
|
142
|
+
y: toDegreesMinutesSeconds(this.y)
|
|
143
|
+
};
|
|
144
|
+
};
|
|
139
145
|
DPoint.prototype.getTileFromCoords = function (zoom) {
|
|
140
146
|
if (zoom === void 0) { zoom = this.z; }
|
|
141
147
|
checkFunction('getTileFromCoords')
|
package/dist/esm/index.js
CHANGED
|
@@ -7,4 +7,4 @@ export * from './FastSearch';
|
|
|
7
7
|
export * from './TraceMatrix';
|
|
8
8
|
export * from './DPolygonLoop';
|
|
9
9
|
export * from './DPlane';
|
|
10
|
-
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, getCombinations, DGeo } from './utils';
|
|
10
|
+
export { gaussianElimination, createCanvas, createArray, createMatrix, isDefAndNotNull, cartesianProduct, getCombinations, parseDegreesMinutesSeconds, DGeo } from './utils';
|
package/dist/esm/utils.js
CHANGED
|
@@ -23,6 +23,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
23
23
|
}
|
|
24
24
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
25
|
};
|
|
26
|
+
var __values = (this && this.__values) || function(o) {
|
|
27
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
28
|
+
if (m) return m.call(o);
|
|
29
|
+
if (o && typeof o.length === "number") return {
|
|
30
|
+
next: function () {
|
|
31
|
+
if (o && i >= o.length) o = void 0;
|
|
32
|
+
return { value: o && o[i++], done: !o };
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
36
|
+
};
|
|
26
37
|
import { DPoint } from './DPoint';
|
|
27
38
|
export var DGeo = {
|
|
28
39
|
DEBUG: false,
|
|
@@ -210,3 +221,44 @@ export var getCombinations = function (arr) {
|
|
|
210
221
|
return ans;
|
|
211
222
|
};
|
|
212
223
|
export var div = function (a, b) { return Math.floor(a / b); };
|
|
224
|
+
export var toDegreesMinutesSeconds = function (v) {
|
|
225
|
+
var degrees = Math.floor(v);
|
|
226
|
+
var t = (v % 1) * 60;
|
|
227
|
+
var minutes = Math.floor(t);
|
|
228
|
+
var t2 = (t % 1) * 60;
|
|
229
|
+
var seconds = t2.toFixed(2);
|
|
230
|
+
return "".concat(degrees, "\u00B0 ").concat(minutes, "' ").concat(seconds, "\"");
|
|
231
|
+
};
|
|
232
|
+
export var parseDegreesMinutesSeconds = function (i) {
|
|
233
|
+
var e_1, _a;
|
|
234
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
235
|
+
var parts = i.matchAll(/(?<value>-?\d+(?<tail>\.\d{0,})?)(?<type>°|'|")/gmiu);
|
|
236
|
+
var d = 0;
|
|
237
|
+
var m = 0;
|
|
238
|
+
var s = 0;
|
|
239
|
+
try {
|
|
240
|
+
for (var parts_1 = __values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) {
|
|
241
|
+
var part = parts_1_1.value;
|
|
242
|
+
switch ((_b = part === null || part === void 0 ? void 0 : part.groups) === null || _b === void 0 ? void 0 : _b.type) {
|
|
243
|
+
case '°':
|
|
244
|
+
d = Number((_d = (_c = part === null || part === void 0 ? void 0 : part.groups) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '0');
|
|
245
|
+
break;
|
|
246
|
+
case '\'':
|
|
247
|
+
m = Number((_f = (_e = part === null || part === void 0 ? void 0 : part.groups) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : '0');
|
|
248
|
+
break;
|
|
249
|
+
case '"':
|
|
250
|
+
s = Number((_h = (_g = part === null || part === void 0 ? void 0 : part.groups) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : '0');
|
|
251
|
+
break;
|
|
252
|
+
default:
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
257
|
+
finally {
|
|
258
|
+
try {
|
|
259
|
+
if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1);
|
|
260
|
+
}
|
|
261
|
+
finally { if (e_1) throw e_1.error; }
|
|
262
|
+
}
|
|
263
|
+
return d + m / 60 + s / 3600;
|
|
264
|
+
};
|