@nshiab/simple-data-analysis-core 0.0.24 → 0.0.26
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randomPointQuery.d.ts","sourceRoot":"","sources":["../../src/methods/randomPointQuery.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"randomPointQuery.d.ts","sourceRoot":"","sources":["../../src/methods/randomPointQuery.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,UA8BtB"}
|
|
@@ -5,14 +5,24 @@ ${newColumn === column
|
|
|
5
5
|
? ""
|
|
6
6
|
: `ALTER TABLE "${table}" ADD COLUMN "${newColumn}" GEOMETRY;`}
|
|
7
7
|
UPDATE "${table}" AS t
|
|
8
|
-
SET "${newColumn}" =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
SET "${newColumn}" = sub.pt
|
|
9
|
+
FROM (
|
|
10
|
+
SELECT
|
|
11
|
+
t_inner.rowid AS rid,
|
|
12
|
+
p.pt
|
|
13
|
+
FROM "${table}" AS t_inner
|
|
14
|
+
CROSS JOIN LATERAL (
|
|
15
|
+
SELECT pt
|
|
16
|
+
FROM (
|
|
17
|
+
SELECT ST_Point(
|
|
18
|
+
ST_XMin(t_inner."${column}") + (CASE WHEN (t_inner.rowid + r.id) IS NOT NULL THEN random() END) * (ST_XMax(t_inner."${column}") - ST_XMin(t_inner."${column}")),
|
|
19
|
+
ST_YMin(t_inner."${column}") + (CASE WHEN (t_inner.rowid + r.id) IS NOT NULL THEN random() END) * (ST_YMax(t_inner."${column}") - ST_YMin(t_inner."${column}"))
|
|
20
|
+
) AS pt
|
|
21
|
+
FROM range(${nbPointsToTry}) AS r(id)
|
|
22
|
+
)
|
|
23
|
+
WHERE ST_Within(pt, t_inner."${column}")
|
|
24
|
+
LIMIT 1
|
|
25
|
+
) AS p
|
|
26
|
+
) AS sub
|
|
27
|
+
WHERE t.rowid = sub.rid;`;
|
|
18
28
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randomPointQuery.d.ts","sourceRoot":"","sources":["../../src/methods/randomPointQuery.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"randomPointQuery.d.ts","sourceRoot":"","sources":["../../src/methods/randomPointQuery.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,UA8BtB"}
|
|
@@ -8,14 +8,24 @@ ${newColumn === column
|
|
|
8
8
|
? ""
|
|
9
9
|
: `ALTER TABLE "${table}" ADD COLUMN "${newColumn}" GEOMETRY;`}
|
|
10
10
|
UPDATE "${table}" AS t
|
|
11
|
-
SET "${newColumn}" =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
SET "${newColumn}" = sub.pt
|
|
12
|
+
FROM (
|
|
13
|
+
SELECT
|
|
14
|
+
t_inner.rowid AS rid,
|
|
15
|
+
p.pt
|
|
16
|
+
FROM "${table}" AS t_inner
|
|
17
|
+
CROSS JOIN LATERAL (
|
|
18
|
+
SELECT pt
|
|
19
|
+
FROM (
|
|
20
|
+
SELECT ST_Point(
|
|
21
|
+
ST_XMin(t_inner."${column}") + (CASE WHEN (t_inner.rowid + r.id) IS NOT NULL THEN random() END) * (ST_XMax(t_inner."${column}") - ST_XMin(t_inner."${column}")),
|
|
22
|
+
ST_YMin(t_inner."${column}") + (CASE WHEN (t_inner.rowid + r.id) IS NOT NULL THEN random() END) * (ST_YMax(t_inner."${column}") - ST_YMin(t_inner."${column}"))
|
|
23
|
+
) AS pt
|
|
24
|
+
FROM range(${nbPointsToTry}) AS r(id)
|
|
25
|
+
)
|
|
26
|
+
WHERE ST_Within(pt, t_inner."${column}")
|
|
27
|
+
LIMIT 1
|
|
28
|
+
) AS p
|
|
29
|
+
) AS sub
|
|
30
|
+
WHERE t.rowid = sub.rid;`;
|
|
21
31
|
}
|