From 8e0a749f92629310af98029b1ac0d68e0a34c7eb Mon Sep 17 00:00:00 2001 From: Valentin de la Cruz Barquero <6054336+vdelacruzb@users.noreply.github.com> Date: Thu, 4 Apr 2024 09:43:39 +0200 Subject: [PATCH] bug(bq,sf,rs|clustering):ST_CLUSTERKMEANS remove duplicated coords (#491) --- .../modules/doc/clustering/ST_CLUSTERKMEANS.md | 4 ++++ .../modules/sql/clustering/ST_CLUSTERKMEANS.sql | 9 ++++++--- .../fixtures/st_clusterkmeans_points2_out.js | 2 +- .../fixtures/st_clusterkmeans_points3_out.js | 2 +- .../libraries/python/lib/clustering/__init__.py | 13 ++++++++++--- .../modules/doc/clustering/ST_CLUSTERKMEANS.md | 4 ++++ .../modules/sql/clustering/ST_CLUSTERKMEANS.sql | 6 +++--- .../clustering/fixtures/st_clusterkmeans_out.txt | 4 ++-- .../modules/doc/clustering/ST_CLUSTERKMEANS.md | 4 ++++ .../modules/sql/clustering/ST_CLUSTERKMEANS.sql | 7 ++++--- .../fixtures/st_clusterkmeans_out_points1.js | 2 +- .../fixtures/st_clusterkmeans_out_points2.js | 2 +- .../fixtures/st_clusterkmeans_out_points3.js | 2 +- 13 files changed, 42 insertions(+), 19 deletions(-) diff --git a/clouds/bigquery/modules/doc/clustering/ST_CLUSTERKMEANS.md b/clouds/bigquery/modules/doc/clustering/ST_CLUSTERKMEANS.md index 5b3d6cd75..793582540 100644 --- a/clouds/bigquery/modules/doc/clustering/ST_CLUSTERKMEANS.md +++ b/clouds/bigquery/modules/doc/clustering/ST_CLUSTERKMEANS.md @@ -11,6 +11,10 @@ Takes a set of points as input and partitions them into clusters using the k-mea * `geog`: `ARRAY` points to be clustered. * `numberOfClusters`: `INT64`|`NULL` numberOfClusters that will be generated. If `NULL` the default value `Math.sqrt(/2)` is used. +````hint:info +The resulting geometries are unique. So duplicated points will be removed from the input array +```` + **Return type** `ARRAY>` diff --git a/clouds/bigquery/modules/sql/clustering/ST_CLUSTERKMEANS.sql b/clouds/bigquery/modules/sql/clustering/ST_CLUSTERKMEANS.sql index 8431fb011..63d7125ef 100644 --- a/clouds/bigquery/modules/sql/clustering/ST_CLUSTERKMEANS.sql +++ b/clouds/bigquery/modules/sql/clustering/ST_CLUSTERKMEANS.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2021 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2021-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION `@@BQ_DATASET@@.__CLUSTERKMEANS` (geojson ARRAY, numberOfClusters INT64) @@ -15,8 +15,11 @@ AS """ const options = {}; if (numberOfClusters != null) { options.numberOfClusters = Number(numberOfClusters); + } else { + options.numberOfClusters = parseInt(Math.sqrt(geojson.length/2)) } options.mutate = true; + geojson = Array.from(new Set(geojson)); const featuresCollection = lib.clustering.featureCollection(geojson.map(x => lib.clustering.feature(JSON.parse(x)))); lib.clustering.clustersKmeans(featuresCollection, options); const cluster = []; diff --git a/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points2_out.js b/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points2_out.js index f237c83ff..0a03efd4f 100644 --- a/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points2_out.js +++ b/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points2_out.js @@ -1,3 +1,3 @@ module.exports = { - value: '[{"cluster":0,"geom":{"value":"POINT(0 0)"}},{"cluster":0,"geom":{"value":"POINT(0 1)"}},{"cluster":2,"geom":{"value":"POINT(5 0)"}},{"cluster":0,"geom":{"value":"POINT(1 0)"}},{"cluster":0,"geom":{"value":"POINT(0 1)"}},{"cluster":2,"geom":{"value":"POINT(5 0)"}},{"cluster":1,"geom":{"value":"POINT(1 19)"}},{"cluster":2,"geom":{"value":"POINT(12 1)"}},{"cluster":2,"geom":{"value":"POINT(9 2)"}},{"cluster":1,"geom":{"value":"POINT(1 10)"}},{"cluster":0,"geom":{"value":"POINT(-3 1)"}},{"cluster":2,"geom":{"value":"POINT(5 5)"}},{"cluster":2,"geom":{"value":"POINT(8 6)"}},{"cluster":2,"geom":{"value":"POINT(10 10)"}},{"cluster":0,"geom":{"value":"POINT(-3 -5)"}},{"cluster":2,"geom":{"value":"POINT(6 5)"}},{"cluster":1,"geom":{"value":"POINT(-8 9)"}},{"cluster":0,"geom":{"value":"POINT(1 -10)"}},{"cluster":0,"geom":{"value":"POINT(2 -2)"}},{"cluster":0,"geom":{"value":"POINT(0 0)"}},{"cluster":1,"geom":{"value":"POINT(3 10)"}}]' + value: '[{"cluster":0,"geom":{"value":"POINT(0 0)"}},{"cluster":0,"geom":{"value":"POINT(0 1)"}},{"cluster":2,"geom":{"value":"POINT(5 0)"}},{"cluster":0,"geom":{"value":"POINT(1 0)"}},{"cluster":1,"geom":{"value":"POINT(1 19)"}},{"cluster":2,"geom":{"value":"POINT(12 1)"}},{"cluster":2,"geom":{"value":"POINT(9 2)"}},{"cluster":1,"geom":{"value":"POINT(1 10)"}},{"cluster":0,"geom":{"value":"POINT(-3 1)"}},{"cluster":2,"geom":{"value":"POINT(5 5)"}},{"cluster":2,"geom":{"value":"POINT(8 6)"}},{"cluster":2,"geom":{"value":"POINT(10 10)"}},{"cluster":0,"geom":{"value":"POINT(-3 -5)"}},{"cluster":2,"geom":{"value":"POINT(6 5)"}},{"cluster":1,"geom":{"value":"POINT(-8 9)"}},{"cluster":0,"geom":{"value":"POINT(1 -10)"}},{"cluster":0,"geom":{"value":"POINT(2 -2)"}},{"cluster":1,"geom":{"value":"POINT(3 10)"}}]' } \ No newline at end of file diff --git a/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points3_out.js b/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points3_out.js index 69840d2e1..27a0f651e 100644 --- a/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points3_out.js +++ b/clouds/bigquery/modules/test/clustering/fixtures/st_clusterkmeans_points3_out.js @@ -1,3 +1,3 @@ module.exports = { - value: '[{"cluster":1,"geom":{"value":"POINT(0 0)"}},{"cluster":1,"geom":{"value":"POINT(0 1)"}},{"cluster":2,"geom":{"value":"POINT(5 0)"}},{"cluster":1,"geom":{"value":"POINT(1 0)"}},{"cluster":1,"geom":{"value":"POINT(0 1)"}},{"cluster":2,"geom":{"value":"POINT(5 0)"}},{"cluster":4,"geom":{"value":"POINT(1 19)"}},{"cluster":2,"geom":{"value":"POINT(12 1)"}},{"cluster":2,"geom":{"value":"POINT(9 2)"}},{"cluster":4,"geom":{"value":"POINT(1 10)"}},{"cluster":1,"geom":{"value":"POINT(-3 1)"}},{"cluster":2,"geom":{"value":"POINT(5 5)"}},{"cluster":2,"geom":{"value":"POINT(8 6)"}},{"cluster":2,"geom":{"value":"POINT(10 10)"}},{"cluster":0,"geom":{"value":"POINT(-3 -5)"}},{"cluster":2,"geom":{"value":"POINT(6 5)"}},{"cluster":4,"geom":{"value":"POINT(-8 9)"}},{"cluster":3,"geom":{"value":"POINT(1 -10)"}},{"cluster":1,"geom":{"value":"POINT(2 -2)"}},{"cluster":1,"geom":{"value":"POINT(0 0)"}},{"cluster":4,"geom":{"value":"POINT(3 10)"}}]' + value: '[{"cluster":0,"geom":{"value":"POINT(0 0)"}},{"cluster":0,"geom":{"value":"POINT(0 1)"}},{"cluster":0,"geom":{"value":"POINT(5 0)"}},{"cluster":0,"geom":{"value":"POINT(1 0)"}},{"cluster":4,"geom":{"value":"POINT(1 19)"}},{"cluster":2,"geom":{"value":"POINT(12 1)"}},{"cluster":2,"geom":{"value":"POINT(9 2)"}},{"cluster":4,"geom":{"value":"POINT(1 10)"}},{"cluster":0,"geom":{"value":"POINT(-3 1)"}},{"cluster":2,"geom":{"value":"POINT(5 5)"}},{"cluster":2,"geom":{"value":"POINT(8 6)"}},{"cluster":2,"geom":{"value":"POINT(10 10)"}},{"cluster":3,"geom":{"value":"POINT(-3 -5)"}},{"cluster":2,"geom":{"value":"POINT(6 5)"}},{"cluster":1,"geom":{"value":"POINT(-8 9)"}},{"cluster":3,"geom":{"value":"POINT(1 -10)"}},{"cluster":0,"geom":{"value":"POINT(2 -2)"}},{"cluster":4,"geom":{"value":"POINT(3 10)"}}]' } \ No newline at end of file diff --git a/clouds/redshift/libraries/python/lib/clustering/__init__.py b/clouds/redshift/libraries/python/lib/clustering/__init__.py index 2f8b44878..c7c275ddb 100644 --- a/clouds/redshift/libraries/python/lib/clustering/__init__.py +++ b/clouds/redshift/libraries/python/lib/clustering/__init__.py @@ -10,6 +10,13 @@ def load_geom(geom): geom = json.dumps(_geom) return loads(geom) +def remove_duplicated_coords(arr): + import numpy as np + unique_rows = [] + for row in arr: + if not any(np.array_equal(row, unique_row) for unique_row in unique_rows): + unique_rows.append(row) + return np.array(unique_rows) def clusterkmeanstable(geom, k): from .kmeans import KMeans @@ -39,14 +46,14 @@ def clusterkmeans(geom, k): if geom.type != 'MultiPoint': raise Exception('Invalid operation: Input points parameter must be MultiPoint.') else: - coords = np.array(list(geojson.utils.coords(geom))) + coords = remove_duplicated_coords(np.array(list(geojson.utils.coords(geom)))) cluster_idxs, centers, loss = KMeans()(coords, k) return geojson.dumps( [ { 'cluster': cluster_idxs[idx], - 'geom': {'coordinates': point, 'type': 'Point'}, + 'geom': {'coordinates': point.tolist(), 'type': 'Point'}, } - for idx, point in enumerate(geom['coordinates']) + for idx, point in enumerate(coords) ] ) diff --git a/clouds/redshift/modules/doc/clustering/ST_CLUSTERKMEANS.md b/clouds/redshift/modules/doc/clustering/ST_CLUSTERKMEANS.md index a4deaabb2..16e703a94 100644 --- a/clouds/redshift/modules/doc/clustering/ST_CLUSTERKMEANS.md +++ b/clouds/redshift/modules/doc/clustering/ST_CLUSTERKMEANS.md @@ -11,6 +11,10 @@ Takes a set of points as input and partitions them into clusters using the k-mea * `geog`: `GEOMETRY` points to be clustered. * `numberOfClusters` (optional): `INT` number of clusters that will be generated. It defaults to the square root of half the number of points (`sqrt(/2)`). +````hint:info +The resulting geometries are unique. So duplicated points will be removed from the input multipoint +```` + **Return type** `SUPER`: containing objects with `cluster` as the cluster id and `geom` as the geometry in GeoJSON format. diff --git a/clouds/redshift/modules/sql/clustering/ST_CLUSTERKMEANS.sql b/clouds/redshift/modules/sql/clustering/ST_CLUSTERKMEANS.sql index 728f4ffeb..aecfa64a1 100644 --- a/clouds/redshift/modules/sql/clustering/ST_CLUSTERKMEANS.sql +++ b/clouds/redshift/modules/sql/clustering/ST_CLUSTERKMEANS.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2021 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2021-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION @@RS_SCHEMA@@.__CLUSTERKMEANS (geom VARCHAR(MAX), numberofClusters INT) diff --git a/clouds/redshift/modules/test/clustering/fixtures/st_clusterkmeans_out.txt b/clouds/redshift/modules/test/clustering/fixtures/st_clusterkmeans_out.txt index b34349470..11dae73d3 100644 --- a/clouds/redshift/modules/test/clustering/fixtures/st_clusterkmeans_out.txt +++ b/clouds/redshift/modules/test/clustering/fixtures/st_clusterkmeans_out.txt @@ -1,3 +1,3 @@ [{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,1.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[5.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[1.0,0.0]}}] -[{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[5.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[1.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[5.0,0.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[1.0,19.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[12.0,1.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[9.0,2.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[1.0,10.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[-3.0,1.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[5.0,5.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[8.0,6.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[10.0,10.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[-3.0,-5.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[6.0,5.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[-8.0,9.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[1.0,-10.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[2.0,-2.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,0.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[3.0,10.0]}}] -[{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[5.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[1.0,0.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[5.0,0.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[1.0,19.0]}},{"cluster":3,"geom":{"type":"Point","coordinates":[12.0,1.0]}},{"cluster":3,"geom":{"type":"Point","coordinates":[9.0,2.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[1.0,10.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[-3.0,1.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[5.0,5.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[8.0,6.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[10.0,10.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[-3.0,-5.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[6.0,5.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[-8.0,9.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[1.0,-10.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[2.0,-2.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[0.0,0.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[3.0,10.0]}}] \ No newline at end of file +[{"cluster":2,"geom":{"type":"Point","coordinates":[0.0,0.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[0.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[5.0,0.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[1.0,0.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[1.0,19.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[12.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[9.0,2.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[1.0,10.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[-3.0,1.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[5.0,5.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[8.0,6.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[10.0,10.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[-3.0,-5.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[6.0,5.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[-8.0,9.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[1.0,-10.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[2.0,-2.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[3.0,10.0]}}] +[{"cluster":3,"geom":{"type":"Point","coordinates":[0.0,0.0]}},{"cluster":3,"geom":{"type":"Point","coordinates":[0.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[5.0,0.0]}},{"cluster":3,"geom":{"type":"Point","coordinates":[1.0,0.0]}},{"cluster":1,"geom":{"type":"Point","coordinates":[1.0,19.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[12.0,1.0]}},{"cluster":0,"geom":{"type":"Point","coordinates":[9.0,2.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[1.0,10.0]}},{"cluster":3,"geom":{"type":"Point","coordinates":[-3.0,1.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[5.0,5.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[8.0,6.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[10.0,10.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[-3.0,-5.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[6.0,5.0]}},{"cluster":3,"geom":{"type":"Point","coordinates":[-8.0,9.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[1.0,-10.0]}},{"cluster":2,"geom":{"type":"Point","coordinates":[2.0,-2.0]}},{"cluster":4,"geom":{"type":"Point","coordinates":[3.0,10.0]}}] \ No newline at end of file diff --git a/clouds/snowflake/modules/doc/clustering/ST_CLUSTERKMEANS.md b/clouds/snowflake/modules/doc/clustering/ST_CLUSTERKMEANS.md index 7df42d4b5..46e9e4b4b 100644 --- a/clouds/snowflake/modules/doc/clustering/ST_CLUSTERKMEANS.md +++ b/clouds/snowflake/modules/doc/clustering/ST_CLUSTERKMEANS.md @@ -11,6 +11,10 @@ Takes a set of points as input and partitions them into clusters using the k-mea * `geojsons`: `ARRAY` points to be clustered. * `numberOfClusters` (optional): `INT` numberOfClusters that will be generated. By default `numberOfClusters` is `Math.sqrt(/2)`. +````hint:info +The resulting geometries are unique. So duplicated points will be removed from the input array +```` + **Return type** `ARRAY`: containing objects with `cluster`, as the cluster id, and `geom`, as the geometry geojson. diff --git a/clouds/snowflake/modules/sql/clustering/ST_CLUSTERKMEANS.sql b/clouds/snowflake/modules/sql/clustering/ST_CLUSTERKMEANS.sql index 0782ffba4..8c6f44d78 100644 --- a/clouds/snowflake/modules/sql/clustering/ST_CLUSTERKMEANS.sql +++ b/clouds/snowflake/modules/sql/clustering/ST_CLUSTERKMEANS.sql @@ -1,6 +1,6 @@ ----------------------------- --- Copyright (C) 2021 CARTO ----------------------------- +-------------------------------- +-- Copyright (C) 2021-2024 CARTO +-------------------------------- CREATE OR REPLACE FUNCTION @@SF_SCHEMA@@._CLUSTERKMEANS (geojsons ARRAY, numberOfClusters DOUBLE) @@ -17,6 +17,7 @@ AS $$ const options = {}; options.numberOfClusters = Number(NUMBEROFCLUSTERS); options.mutate = true; + GEOJSONS = Array.from(new Set(GEOJSONS)); const featuresCollection = clusteringLib.featureCollection(GEOJSONS.map(x => clusteringLib.feature(JSON.parse(x)))); clusteringLib.clustersKmeans(featuresCollection, options); const cluster = []; diff --git a/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points1.js b/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points1.js index 0a0228f57..483619843 100644 --- a/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points1.js +++ b/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points1.js @@ -1,3 +1,3 @@ module.exports = { - value: '[{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[1,0],\\\"type\\\":\\\"Point\\\"}\"}]' + value: '[{"cluster":1,"geom":"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":1,"geom":"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":1,"geom":"{\\\"coordinates\\\":[1,0],\\\"type\\\":\\\"Point\\\"}"}]' } \ No newline at end of file diff --git a/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points2.js b/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points2.js index 5ccf200e7..88ff55bfb 100644 --- a/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points2.js +++ b/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points2.js @@ -1,3 +1,3 @@ module.exports = { - value: '[{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[1,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[1,19],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[12,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[9,2],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[1,10],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[-3,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[5,5],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[8,6],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[10,10],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[-3,-5],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[6,5],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[-8,9],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[1,-10],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[2,-2],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[3,10],\\\"type\\\":\\\"Point\\\"}\"}]' + value: '[{"cluster":0,"geom":"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[1,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":1,"geom":"{\\\"coordinates\\\":[1,19],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[12,1],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[9,2],\\\"type\\\":\\\"Point\\\"}"},{"cluster":1,"geom":"{\\\"coordinates\\\":[1,10],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[-3,1],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[5,5],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[8,6],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[10,10],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[-3,-5],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[6,5],\\\"type\\\":\\\"Point\\\"}"},{"cluster":1,"geom":"{\\\"coordinates\\\":[-8,9],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[1,-10],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[2,-2],\\\"type\\\":\\\"Point\\\"}"},{"cluster":1,"geom":"{\\\"coordinates\\\":[3,10],\\\"type\\\":\\\"Point\\\"}"}]' } \ No newline at end of file diff --git a/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points3.js b/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points3.js index 93a0b4efc..e4a9a9e0c 100644 --- a/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points3.js +++ b/clouds/snowflake/modules/test/clustering/fixtures/st_clusterkmeans_out_points3.js @@ -1,3 +1,3 @@ module.exports = { - value: '[{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[1,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":4,\"geom\":\"{\\\"coordinates\\\":[1,19],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[12,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[9,2],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":4,\"geom\":\"{\\\"coordinates\\\":[1,10],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[-3,1],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[5,5],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[8,6],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[10,10],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":0,\"geom\":\"{\\\"coordinates\\\":[-3,-5],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":2,\"geom\":\"{\\\"coordinates\\\":[6,5],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":4,\"geom\":\"{\\\"coordinates\\\":[-8,9],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":3,\"geom\":\"{\\\"coordinates\\\":[1,-10],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[2,-2],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":1,\"geom\":\"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}\"},{\"cluster\":4,\"geom\":\"{\\\"coordinates\\\":[3,10],\\\"type\\\":\\\"Point\\\"}\"}]' + value: '[{"cluster":0,"geom":"{\\\"coordinates\\\":[0,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[0,1],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[5,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[1,0],\\\"type\\\":\\\"Point\\\"}"},{"cluster":4,"geom":"{\\\"coordinates\\\":[1,19],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[12,1],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[9,2],\\\"type\\\":\\\"Point\\\"}"},{"cluster":4,"geom":"{\\\"coordinates\\\":[1,10],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[-3,1],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[5,5],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[8,6],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[10,10],\\\"type\\\":\\\"Point\\\"}"},{"cluster":3,"geom":"{\\\"coordinates\\\":[-3,-5],\\\"type\\\":\\\"Point\\\"}"},{"cluster":2,"geom":"{\\\"coordinates\\\":[6,5],\\\"type\\\":\\\"Point\\\"}"},{"cluster":1,"geom":"{\\\"coordinates\\\":[-8,9],\\\"type\\\":\\\"Point\\\"}"},{"cluster":3,"geom":"{\\\"coordinates\\\":[1,-10],\\\"type\\\":\\\"Point\\\"}"},{"cluster":0,"geom":"{\\\"coordinates\\\":[2,-2],\\\"type\\\":\\\"Point\\\"}"},{"cluster":4,"geom":"{\\\"coordinates\\\":[3,10],\\\"type\\\":\\\"Point\\\"}"}]' } \ No newline at end of file