{"action":"closed","number":850,"pull_request":{"url":"https://api.github.com/repos/Turfjs/turf/pulls/850","id":131468496,"html_url":"https://github.com/Turfjs/turf/pull/850","diff_url":"https://github.com/Turfjs/turf/pull/850.diff","patch_url":"https://github.com/Turfjs/turf/pull/850.patch","issue_url":"https://api.github.com/repos/Turfjs/turf/issues/850","number":850,"state":"closed","locked":false,"title":"Change output type of clusters-kmeans","user":{"login":"DenisCarriere","id":550895,"avatar_url":"https://avatars3.githubusercontent.com/u/550895?v=4","gravatar_id":"","url":"https://api.github.com/users/DenisCarriere","html_url":"https://github.com/DenisCarriere","followers_url":"https://api.github.com/users/DenisCarriere/followers","following_url":"https://api.github.com/users/DenisCarriere/following{/other_user}","gists_url":"https://api.github.com/users/DenisCarriere/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisCarriere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisCarriere/subscriptions","organizations_url":"https://api.github.com/users/DenisCarriere/orgs","repos_url":"https://api.github.com/users/DenisCarriere/repos","events_url":"https://api.github.com/users/DenisCarriere/events{/privacy}","received_events_url":"https://api.github.com/users/DenisCarriere/received_events","type":"User","site_admin":false},"body":"# Updates to `@turf/clusters-kmeans`\r\n\r\n- [x] Outputs simple FeatureCollection (with additional properties `cluster`)\r\n- [x] Dropped `numberOfClusters can\\'t be greater than the number of points` (number of Clusters fallbacks to the count instead of throwing an error since the user might be passing multiple featureCollections and the total number of features is unknown/variable)\r\n- [x] Update typescript definition\r\n- [x] Update tests\r\n- [x] Dropped making centroids in `index.js`\r\n- [x] Added `clone` to prevent any input mutation\r\n- [x] Add Centroid & Concave polygons to test outputs using `clusterEach` (visual/testing purposes only)\r\n- [x] Added Input mutation tests & add `mutate` param to allow input to be mutated\r\n- [x] **(Optional)** Allow user input to be mutated via parameter (mutation should be disabled by default)?\r\n\r\n## JSDocs\r\n\r\n```js\r\n/**\r\n * Takes a set of {@link Point|points} and partition them into clusters using the k-mean .\r\n * It uses the [k-means algorithm](https://en.wikipedia.org/wiki/K-means_clustering)\r\n *\r\n * @name clustersKmeans\r\n * @param {FeatureCollection<Point>} points to be clustered\r\n * @param {number} [numberOfClusters=Math.sqrt(numberOfPoints/2)] numberOfClusters that will be generated\r\n * @param {boolean} [mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\r\n * @returns {FeatureCollection<Point>} Clustered Points with an additional two properties associated to each Feature:\r\n * - {number} cluster - the associated clusterId\r\n * - {[number, number]} centroid - Centroid of the cluster [Longitude, Latitude]\r\n * @example\r\n * // create random points with random z-values in their properties\r\n * var points = turf.random('point', 100, {\r\n *   bbox: [0, 30, 20, 50]\r\n * });\r\n * var numberOfClusters = 7;\r\n * var clustered = turf.clustersKmeans(points, numberOfClusters);\r\n *\r\n * //addToMap\r\n * var addToMap = clustered;\r\n */\r\nmodule.exports = function (points, numberOfClusters, mutate) {\r\n```\r\n\r\n## Example\r\n![image](https://user-images.githubusercontent.com/550895/28434078-217e928e-6d5c-11e7-9d48-f6c586c76ec2.png)\r\n\r\n","created_at":"2017-07-20T04:39:07Z","updated_at":"2017-07-21T04:01:10Z","closed_at":"2017-07-21T04:01:10Z","merged_at":"2017-07-21T04:01:10Z","merge_commit_sha":"ab7b472ebe8af5170fa894c56206a13e8e191aea","assignee":{"login":"DenisCarriere","id":550895,"avatar_url":"https://avatars3.githubusercontent.com/u/550895?v=4","gravatar_id":"","url":"https://api.github.com/users/DenisCarriere","html_url":"https://github.com/DenisCarriere","followers_url":"https://api.github.com/users/DenisCarriere/followers","following_url":"https://api.github.com/users/DenisCarriere/following{/other_user}","gists_url":"https://api.github.com/users/DenisCarriere/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisCarriere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisCarriere/subscriptions","organizations_url":"https://api.github.com/users/DenisCarriere/orgs","repos_url":"https://api.github.com/users/DenisCarriere/repos","events_url":"https://api.github.com/users/DenisCarriere/events{/privacy}","received_events_url":"https://api.github.com/users/DenisCarriere/received_events","type":"User","site_admin":false},"assignees":[{"login":"DenisCarriere","id":550895,"avatar_url":"https://avatars3.githubusercontent.com/u/550895?v=4","gravatar_id":"","url":"https://api.github.com/users/DenisCarriere","html_url":"https://github.com/DenisCarriere","followers_url":"https://api.github.com/users/DenisCarriere/followers","following_url":"https://api.github.com/users/DenisCarriere/following{/other_user}","gists_url":"https://api.github.com/users/DenisCarriere/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisCarriere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisCarriere/subscriptions","organizations_url":"https://api.github.com/users/DenisCarriere/orgs","repos_url":"https://api.github.com/users/DenisCarriere/repos","events_url":"https://api.github.com/users/DenisCarriere/events{/privacy}","received_events_url":"https://api.github.com/users/DenisCarriere/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/Turfjs/turf/milestones/10","html_url":"https://github.com/Turfjs/turf/milestone/10","labels_url":"https://api.github.com/repos/Turfjs/turf/milestones/10/labels","id":2614622,"number":10,"title":"4.6.0","description":"Minor release: patches, new features & new modules","creator":{"login":"DenisCarriere","id":550895,"avatar_url":"https://avatars3.githubusercontent.com/u/550895?v=4","gravatar_id":"","url":"https://api.github.com/users/DenisCarriere","html_url":"https://github.com/DenisCarriere","followers_url":"https://api.github.com/users/DenisCarriere/followers","following_url":"https://api.github.com/users/DenisCarriere/following{/other_user}","gists_url":"https://api.github.com/users/DenisCarriere/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisCarriere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisCarriere/subscriptions","organizations_url":"https://api.github.com/users/DenisCarriere/orgs","repos_url":"https://api.github.com/users/DenisCarriere/repos","events_url":"https://api.github.com/users/DenisCarriere/events{/privacy}","received_events_url":"https://api.github.com/users/DenisCarriere/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":11,"state":"open","created_at":"2017-06-30T12:17:05Z","updated_at":"2017-07-21T04:01:10Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Turfjs/turf/pulls/850/commits","review_comments_url":"https://api.github.com/repos/Turfjs/turf/pulls/850/comments","review_comment_url":"https://api.github.com/repos/Turfjs/turf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Turfjs/turf/issues/850/comments","statuses_url":"https://api.github.com/repos/Turfjs/turf/statuses/9053deea217fecbae060819af2d4a36f3c16e8d3","head":{"label":"Turfjs:update-clusters-kmeans","ref":"update-clusters-kmeans","sha":"9053deea217fecbae060819af2d4a36f3c16e8d3","user":{"login":"Turfjs","id":7736769,"avatar_url":"https://avatars1.githubusercontent.com/u/7736769?v=4","gravatar_id":"","url":"https://api.github.com/users/Turfjs","html_url":"https://github.com/Turfjs","followers_url":"https://api.github.com/users/Turfjs/followers","following_url":"https://api.github.com/users/Turfjs/following{/other_user}","gists_url":"https://api.github.com/users/Turfjs/gists{/gist_id}","starred_url":"https://api.github.com/users/Turfjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Turfjs/subscriptions","organizations_url":"https://api.github.com/users/Turfjs/orgs","repos_url":"https://api.github.com/users/Turfjs/repos","events_url":"https://api.github.com/users/Turfjs/events{/privacy}","received_events_url":"https://api.github.com/users/Turfjs/received_events","type":"Organization","site_admin":false},"repo":{"id":13301038,"name":"turf","full_name":"Turfjs/turf","owner":{"login":"Turfjs","id":7736769,"avatar_url":"https://avatars1.githubusercontent.com/u/7736769?v=4","gravatar_id":"","url":"https://api.github.com/users/Turfjs","html_url":"https://github.com/Turfjs","followers_url":"https://api.github.com/users/Turfjs/followers","following_url":"https://api.github.com/users/Turfjs/following{/other_user}","gists_url":"https://api.github.com/users/Turfjs/gists{/gist_id}","starred_url":"https://api.github.com/users/Turfjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Turfjs/subscriptions","organizations_url":"https://api.github.com/users/Turfjs/orgs","repos_url":"https://api.github.com/users/Turfjs/repos","events_url":"https://api.github.com/users/Turfjs/events{/privacy}","received_events_url":"https://api.github.com/users/Turfjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Turfjs/turf","description":"A modular geospatial engine written in JavaScript","fork":false,"url":"https://api.github.com/repos/Turfjs/turf","forks_url":"https://api.github.com/repos/Turfjs/turf/forks","keys_url":"https://api.github.com/repos/Turfjs/turf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Turfjs/turf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Turfjs/turf/teams","hooks_url":"https://api.github.com/repos/Turfjs/turf/hooks","issue_events_url":"https://api.github.com/repos/Turfjs/turf/issues/events{/number}","events_url":"https://api.github.com/repos/Turfjs/turf/events","assignees_url":"https://api.github.com/repos/Turfjs/turf/assignees{/user}","branches_url":"https://api.github.com/repos/Turfjs/turf/branches{/branch}","tags_url":"https://api.github.com/repos/Turfjs/turf/tags","blobs_url":"https://api.github.com/repos/Turfjs/turf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Turfjs/turf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Turfjs/turf/git/refs{/sha}","trees_url":"https://api.github.com/repos/Turfjs/turf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Turfjs/turf/statuses/{sha}","languages_url":"https://api.github.com/repos/Turfjs/turf/languages","stargazers_url":"https://api.github.com/repos/Turfjs/turf/stargazers","contributors_url":"https://api.github.com/repos/Turfjs/turf/contributors","subscribers_url":"https://api.github.com/repos/Turfjs/turf/subscribers","subscription_url":"https://api.github.com/repos/Turfjs/turf/subscription","commits_url":"https://api.github.com/repos/Turfjs/turf/commits{/sha}","git_commits_url":"https://api.github.com/repos/Turfjs/turf/git/commits{/sha}","comments_url":"https://api.github.com/repos/Turfjs/turf/comments{/number}","issue_comment_url":"https://api.github.com/repos/Turfjs/turf/issues/comments{/number}","contents_url":"https://api.github.com/repos/Turfjs/turf/contents/{+path}","compare_url":"https://api.github.com/repos/Turfjs/turf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Turfjs/turf/merges","archive_url":"https://api.github.com/repos/Turfjs/turf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Turfjs/turf/downloads","issues_url":"https://api.github.com/repos/Turfjs/turf/issues{/number}","pulls_url":"https://api.github.com/repos/Turfjs/turf/pulls{/number}","milestones_url":"https://api.github.com/repos/Turfjs/turf/milestones{/number}","notifications_url":"https://api.github.com/repos/Turfjs/turf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Turfjs/turf/labels{/name}","releases_url":"https://api.github.com/repos/Turfjs/turf/releases{/id}","deployments_url":"https://api.github.com/repos/Turfjs/turf/deployments","created_at":"2013-10-03T14:50:25Z","updated_at":"2017-07-20T00:50:39Z","pushed_at":"2017-07-21T04:01:10Z","git_url":"git://github.com/Turfjs/turf.git","ssh_url":"git@github.com:Turfjs/turf.git","clone_url":"https://github.com/Turfjs/turf.git","svn_url":"https://github.com/Turfjs/turf","homepage":"http://turfjs.org/","size":25365,"stargazers_count":2773,"watchers_count":2773,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":239,"mirror_url":null,"open_issues_count":41,"forks":239,"open_issues":41,"watchers":2773,"default_branch":"master"}},"base":{"label":"Turfjs:master","ref":"master","sha":"350ab1ef4e32e1472e5b600a54f37bbb52251c09","user":{"login":"Turfjs","id":7736769,"avatar_url":"https://avatars1.githubusercontent.com/u/7736769?v=4","gravatar_id":"","url":"https://api.github.com/users/Turfjs","html_url":"https://github.com/Turfjs","followers_url":"https://api.github.com/users/Turfjs/followers","following_url":"https://api.github.com/users/Turfjs/following{/other_user}","gists_url":"https://api.github.com/users/Turfjs/gists{/gist_id}","starred_url":"https://api.github.com/users/Turfjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Turfjs/subscriptions","organizations_url":"https://api.github.com/users/Turfjs/orgs","repos_url":"https://api.github.com/users/Turfjs/repos","events_url":"https://api.github.com/users/Turfjs/events{/privacy}","received_events_url":"https://api.github.com/users/Turfjs/received_events","type":"Organization","site_admin":false},"repo":{"id":13301038,"name":"turf","full_name":"Turfjs/turf","owner":{"login":"Turfjs","id":7736769,"avatar_url":"https://avatars1.githubusercontent.com/u/7736769?v=4","gravatar_id":"","url":"https://api.github.com/users/Turfjs","html_url":"https://github.com/Turfjs","followers_url":"https://api.github.com/users/Turfjs/followers","following_url":"https://api.github.com/users/Turfjs/following{/other_user}","gists_url":"https://api.github.com/users/Turfjs/gists{/gist_id}","starred_url":"https://api.github.com/users/Turfjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Turfjs/subscriptions","organizations_url":"https://api.github.com/users/Turfjs/orgs","repos_url":"https://api.github.com/users/Turfjs/repos","events_url":"https://api.github.com/users/Turfjs/events{/privacy}","received_events_url":"https://api.github.com/users/Turfjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Turfjs/turf","description":"A modular geospatial engine written in JavaScript","fork":false,"url":"https://api.github.com/repos/Turfjs/turf","forks_url":"https://api.github.com/repos/Turfjs/turf/forks","keys_url":"https://api.github.com/repos/Turfjs/turf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Turfjs/turf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Turfjs/turf/teams","hooks_url":"https://api.github.com/repos/Turfjs/turf/hooks","issue_events_url":"https://api.github.com/repos/Turfjs/turf/issues/events{/number}","events_url":"https://api.github.com/repos/Turfjs/turf/events","assignees_url":"https://api.github.com/repos/Turfjs/turf/assignees{/user}","branches_url":"https://api.github.com/repos/Turfjs/turf/branches{/branch}","tags_url":"https://api.github.com/repos/Turfjs/turf/tags","blobs_url":"https://api.github.com/repos/Turfjs/turf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Turfjs/turf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Turfjs/turf/git/refs{/sha}","trees_url":"https://api.github.com/repos/Turfjs/turf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Turfjs/turf/statuses/{sha}","languages_url":"https://api.github.com/repos/Turfjs/turf/languages","stargazers_url":"https://api.github.com/repos/Turfjs/turf/stargazers","contributors_url":"https://api.github.com/repos/Turfjs/turf/contributors","subscribers_url":"https://api.github.com/repos/Turfjs/turf/subscribers","subscription_url":"https://api.github.com/repos/Turfjs/turf/subscription","commits_url":"https://api.github.com/repos/Turfjs/turf/commits{/sha}","git_commits_url":"https://api.github.com/repos/Turfjs/turf/git/commits{/sha}","comments_url":"https://api.github.com/repos/Turfjs/turf/comments{/number}","issue_comment_url":"https://api.github.com/repos/Turfjs/turf/issues/comments{/number}","contents_url":"https://api.github.com/repos/Turfjs/turf/contents/{+path}","compare_url":"https://api.github.com/repos/Turfjs/turf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Turfjs/turf/merges","archive_url":"https://api.github.com/repos/Turfjs/turf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Turfjs/turf/downloads","issues_url":"https://api.github.com/repos/Turfjs/turf/issues{/number}","pulls_url":"https://api.github.com/repos/Turfjs/turf/pulls{/number}","milestones_url":"https://api.github.com/repos/Turfjs/turf/milestones{/number}","notifications_url":"https://api.github.com/repos/Turfjs/turf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Turfjs/turf/labels{/name}","releases_url":"https://api.github.com/repos/Turfjs/turf/releases{/id}","deployments_url":"https://api.github.com/repos/Turfjs/turf/deployments","created_at":"2013-10-03T14:50:25Z","updated_at":"2017-07-20T00:50:39Z","pushed_at":"2017-07-21T04:01:10Z","git_url":"git://github.com/Turfjs/turf.git","ssh_url":"git@github.com:Turfjs/turf.git","clone_url":"https://github.com/Turfjs/turf.git","svn_url":"https://github.com/Turfjs/turf","homepage":"http://turfjs.org/","size":25365,"stargazers_count":2773,"watchers_count":2773,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":239,"mirror_url":null,"open_issues_count":41,"forks":239,"open_issues":41,"watchers":2773,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Turfjs/turf/pulls/850"},"html":{"href":"https://github.com/Turfjs/turf/pull/850"},"issue":{"href":"https://api.github.com/repos/Turfjs/turf/issues/850"},"comments":{"href":"https://api.github.com/repos/Turfjs/turf/issues/850/comments"},"review_comments":{"href":"https://api.github.com/repos/Turfjs/turf/pulls/850/comments"},"review_comment":{"href":"https://api.github.com/repos/Turfjs/turf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Turfjs/turf/pulls/850/commits"},"statuses":{"href":"https://api.github.com/repos/Turfjs/turf/statuses/9053deea217fecbae060819af2d4a36f3c16e8d3"}},"merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"DenisCarriere","id":550895,"avatar_url":"https://avatars3.githubusercontent.com/u/550895?v=4","gravatar_id":"","url":"https://api.github.com/users/DenisCarriere","html_url":"https://github.com/DenisCarriere","followers_url":"https://api.github.com/users/DenisCarriere/followers","following_url":"https://api.github.com/users/DenisCarriere/following{/other_user}","gists_url":"https://api.github.com/users/DenisCarriere/gists{/gist_id}","starred_url":"https://api.github.com/users/DenisCarriere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenisCarriere/subscriptions","organizations_url":"https://api.github.com/users/DenisCarriere/orgs","repos_url":"https://api.github.com/users/DenisCarriere/repos","events_url":"https://api.github.com/users/DenisCarriere/events{/privacy}","received_events_url":"https://api.github.com/users/DenisCarriere/received_events","type":"User","site_admin":false},"comments":4,"review_comments":6,"maintainer_can_modify":false,"commits":8,"additions":4500,"deletions":114,"changed_files":13}}
{"actor":{"display_login":"DenisCarriere"}}