@openforis/arena-core 2.18.17 → 2.18.18

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.
@@ -1,10 +1,13 @@
1
1
  import { PointFactory } from '../pointFactory';
2
- const POINT_REGEX = /SRID=((EPSG:)?(\w+));POINT\((-?\d+(\.\d+)?) (-?\d+(\.\d+)?)\)/;
2
+ // coordinates can be in exponent notation (e.g. 1e-7), as generated by Number.toString or by PostgreSQL for very small or big numbers
3
+ const NUMBER_PATTERN = String.raw `-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?`;
4
+ const POINT_REGEX = new RegExp(String.raw `SRID=((EPSG:)?(\w+));POINT\((${NUMBER_PATTERN}) (${NUMBER_PATTERN})\)`);
3
5
  /**
4
6
  * Parses a point in the format: SRID=SRS_CODE;POINT(X Y)
5
7
  * (X and Y separated by a space). Valid examples are:
6
8
  * - SRID=EPSG:4326;POINT(12.489060 41.882788)
7
- * - SRID=4326;POINT(12 41).
9
+ * - SRID=4326;POINT(12 41)
10
+ * - SRID=4326;POINT(1e-7 41).
8
11
  *
9
12
  * @param {!(string | object)} value - The point to parse. It can be a string or an object.
10
13
  * @returns {Point} - The parsed Point object.
@@ -20,7 +23,7 @@ export const parse = (value) => {
20
23
  return null;
21
24
  const srs = match[3];
22
25
  const x = Number(match[4]);
23
- const y = Number(match[6]);
26
+ const y = Number(match[5]);
24
27
  return PointFactory.createInstance({ srs, x, y });
25
28
  }
26
29
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/geo/points/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,MAAM,WAAW,GAAG,+DAA+D,CAAA;AAEnF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAsB,EAAgB,EAAE;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAc,CAAA;IAEpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACrC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QAEvB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,OAAO,YAAY,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["import { Point } from '../point'\nimport { PointFactory } from '../pointFactory'\n\nconst POINT_REGEX = /SRID=((EPSG:)?(\\w+));POINT\\((-?\\d+(\\.\\d+)?) (-?\\d+(\\.\\d+)?)\\)/\n\n/**\n * Parses a point in the format: SRID=SRS_CODE;POINT(X Y)\n * (X and Y separated by a space). Valid examples are:\n * - SRID=EPSG:4326;POINT(12.489060 41.882788)\n * - SRID=4326;POINT(12 41).\n *\n * @param {!(string | object)} value - The point to parse. It can be a string or an object.\n * @returns {Point} - The parsed Point object.\n */\nexport const parse = (value: string | object): Point | null => {\n if (!value) return null\n\n if (typeof value === 'object') return value as Point\n\n if (typeof value === 'string') {\n const match = POINT_REGEX.exec(value)\n if (!match) return null\n\n const srs = match[3]\n const x = Number(match[4])\n const y = Number(match[6])\n return PointFactory.createInstance({ srs, x, y })\n }\n return null\n}\n"]}
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/geo/points/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,sIAAsI;AACtI,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA,kCAAkC,CAAA;AACnE,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,gCAAgC,cAAc,MAAM,cAAc,KAAK,CAAC,CAAA;AAEjH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAsB,EAAgB,EAAE;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAc,CAAA;IAEpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACrC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QAEvB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,OAAO,YAAY,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["import { Point } from '../point'\nimport { PointFactory } from '../pointFactory'\n\n// coordinates can be in exponent notation (e.g. 1e-7), as generated by Number.toString or by PostgreSQL for very small or big numbers\nconst NUMBER_PATTERN = String.raw`-?\\d+(?:\\.\\d+)?(?:[eE][-+]?\\d+)?`\nconst POINT_REGEX = new RegExp(String.raw`SRID=((EPSG:)?(\\w+));POINT\\((${NUMBER_PATTERN}) (${NUMBER_PATTERN})\\)`)\n\n/**\n * Parses a point in the format: SRID=SRS_CODE;POINT(X Y)\n * (X and Y separated by a space). Valid examples are:\n * - SRID=EPSG:4326;POINT(12.489060 41.882788)\n * - SRID=4326;POINT(12 41)\n * - SRID=4326;POINT(1e-7 41).\n *\n * @param {!(string | object)} value - The point to parse. It can be a string or an object.\n * @returns {Point} - The parsed Point object.\n */\nexport const parse = (value: string | object): Point | null => {\n if (!value) return null\n\n if (typeof value === 'object') return value as Point\n\n if (typeof value === 'string') {\n const match = POINT_REGEX.exec(value)\n if (!match) return null\n\n const srs = match[3]\n const x = Number(match[4])\n const y = Number(match[5])\n return PointFactory.createInstance({ srs, x, y })\n }\n return null\n}\n"]}
@@ -3,7 +3,8 @@ import { Point } from '../point';
3
3
  * Parses a point in the format: SRID=SRS_CODE;POINT(X Y)
4
4
  * (X and Y separated by a space). Valid examples are:
5
5
  * - SRID=EPSG:4326;POINT(12.489060 41.882788)
6
- * - SRID=4326;POINT(12 41).
6
+ * - SRID=4326;POINT(12 41)
7
+ * - SRID=4326;POINT(1e-7 41).
7
8
  *
8
9
  * @param {!(string | object)} value - The point to parse. It can be a string or an object.
9
10
  * @returns {Point} - The parsed Point object.
@@ -2,12 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parse = void 0;
4
4
  const pointFactory_1 = require("../pointFactory");
5
- const POINT_REGEX = /SRID=((EPSG:)?(\w+));POINT\((-?\d+(\.\d+)?) (-?\d+(\.\d+)?)\)/;
5
+ // coordinates can be in exponent notation (e.g. 1e-7), as generated by Number.toString or by PostgreSQL for very small or big numbers
6
+ const NUMBER_PATTERN = String.raw `-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?`;
7
+ const POINT_REGEX = new RegExp(String.raw `SRID=((EPSG:)?(\w+));POINT\((${NUMBER_PATTERN}) (${NUMBER_PATTERN})\)`);
6
8
  /**
7
9
  * Parses a point in the format: SRID=SRS_CODE;POINT(X Y)
8
10
  * (X and Y separated by a space). Valid examples are:
9
11
  * - SRID=EPSG:4326;POINT(12.489060 41.882788)
10
- * - SRID=4326;POINT(12 41).
12
+ * - SRID=4326;POINT(12 41)
13
+ * - SRID=4326;POINT(1e-7 41).
11
14
  *
12
15
  * @param {!(string | object)} value - The point to parse. It can be a string or an object.
13
16
  * @returns {Point} - The parsed Point object.
@@ -23,7 +26,7 @@ const parse = (value) => {
23
26
  return null;
24
27
  const srs = match[3];
25
28
  const x = Number(match[4]);
26
- const y = Number(match[6]);
29
+ const y = Number(match[5]);
27
30
  return pointFactory_1.PointFactory.createInstance({ srs, x, y });
28
31
  }
29
32
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/geo/points/parse.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,MAAM,WAAW,GAAG,+DAA+D,CAAA;AAEnF;;;;;;;;GAQG;AACI,MAAM,KAAK,GAAG,CAAC,KAAsB,EAAgB,EAAE;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAc,CAAA;IAEpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACrC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QAEvB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,OAAO,2BAAY,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAfY,QAAA,KAAK,GAAL,KAAK,CAejB","sourcesContent":["import { Point } from '../point'\nimport { PointFactory } from '../pointFactory'\n\nconst POINT_REGEX = /SRID=((EPSG:)?(\\w+));POINT\\((-?\\d+(\\.\\d+)?) (-?\\d+(\\.\\d+)?)\\)/\n\n/**\n * Parses a point in the format: SRID=SRS_CODE;POINT(X Y)\n * (X and Y separated by a space). Valid examples are:\n * - SRID=EPSG:4326;POINT(12.489060 41.882788)\n * - SRID=4326;POINT(12 41).\n *\n * @param {!(string | object)} value - The point to parse. It can be a string or an object.\n * @returns {Point} - The parsed Point object.\n */\nexport const parse = (value: string | object): Point | null => {\n if (!value) return null\n\n if (typeof value === 'object') return value as Point\n\n if (typeof value === 'string') {\n const match = POINT_REGEX.exec(value)\n if (!match) return null\n\n const srs = match[3]\n const x = Number(match[4])\n const y = Number(match[6])\n return PointFactory.createInstance({ srs, x, y })\n }\n return null\n}\n"]}
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/geo/points/parse.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,sIAAsI;AACtI,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA,kCAAkC,CAAA;AACnE,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,gCAAgC,cAAc,MAAM,cAAc,KAAK,CAAC,CAAA;AAEjH;;;;;;;;;GASG;AACI,MAAM,KAAK,GAAG,CAAC,KAAsB,EAAgB,EAAE;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAc,CAAA;IAEpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACrC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QAEvB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,OAAO,2BAAY,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAfY,QAAA,KAAK,GAAL,KAAK,CAejB","sourcesContent":["import { Point } from '../point'\nimport { PointFactory } from '../pointFactory'\n\n// coordinates can be in exponent notation (e.g. 1e-7), as generated by Number.toString or by PostgreSQL for very small or big numbers\nconst NUMBER_PATTERN = String.raw`-?\\d+(?:\\.\\d+)?(?:[eE][-+]?\\d+)?`\nconst POINT_REGEX = new RegExp(String.raw`SRID=((EPSG:)?(\\w+));POINT\\((${NUMBER_PATTERN}) (${NUMBER_PATTERN})\\)`)\n\n/**\n * Parses a point in the format: SRID=SRS_CODE;POINT(X Y)\n * (X and Y separated by a space). Valid examples are:\n * - SRID=EPSG:4326;POINT(12.489060 41.882788)\n * - SRID=4326;POINT(12 41)\n * - SRID=4326;POINT(1e-7 41).\n *\n * @param {!(string | object)} value - The point to parse. It can be a string or an object.\n * @returns {Point} - The parsed Point object.\n */\nexport const parse = (value: string | object): Point | null => {\n if (!value) return null\n\n if (typeof value === 'object') return value as Point\n\n if (typeof value === 'string') {\n const match = POINT_REGEX.exec(value)\n if (!match) return null\n\n const srs = match[3]\n const x = Number(match[4])\n const y = Number(match[5])\n return PointFactory.createInstance({ srs, x, y })\n }\n return null\n}\n"]}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "OpenForis",
5
5
  "email": "openforis.arena@gmail.com"
6
6
  },
7
- "version": "2.18.17",
7
+ "version": "2.18.18",
8
8
  "description": "Arena core module",
9
9
  "repository": {
10
10
  "type": "git",