From: Darafei Praliaskouski Date: Tue, 2 Jan 2018 14:06:27 +0000 (+0000) Subject: Fix KMeans initialization issue that lost clusters sometimes. X-Git-Tag: 2.4.3rc1~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8bd8759e2e2c16b2eb38b8a65b6dc1c37e362096;p=postgis Fix KMeans initialization issue that lost clusters sometimes. Closes #3965 Closes https://github.com/postgis/postgis/pull/179 git-svn-id: http://svn.osgeo.org/postgis/branches/2.4@16213 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index 738f48fe9..3df658729 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,13 @@ PostGIS 2.4.3 -2017/xx/xx +2018/xx/xx * Bug fixes * - #3713, Support encodings that happen to output a '\' character - #3827, Set configure default to not do interrupt testing, - was causing false negatives for many people + was causing false negatives for many people - #3930, Minimum bounding circle issues on 32-bit platforms + - #3965, ST_ClusterKMeans used to lose some clusters on initialization + (Darafei Praliaskouski) * Enhancements * - #3944, Update to EPSG register v9.2 (Even Rouault) diff --git a/liblwgeom/lwkmeans.c b/liblwgeom/lwkmeans.c index e7f576048..d92c41aed 100644 --- a/liblwgeom/lwkmeans.c +++ b/liblwgeom/lwkmeans.c @@ -201,6 +201,7 @@ lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, int ngeoms, int k) if (seen[j] == closest) { closest = (closest + 1) % config.num_objs; + j = 0; } else {