From 4413ced89b0c24244f7eb7e7604c694969ff77c0 Mon Sep 17 00:00:00 2001 From: Calvin Metcalf Date: Wed, 18 May 2016 12:44:26 -0400 Subject: [PATCH 1/6] add custom type --- lib/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/index.js b/lib/index.js index d4a8aed..5020a4c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -185,6 +185,8 @@ export default class Layer extends EE.EventEmitter { case 'point': out.layer.query.select.type = 'geo.dot'; break; + default: + out.layer.query.select.type = 'geo.' + type; } if (this._sort) { out.layer.style.orderBy = this._sort; From da51fe97379980c37c149f2f3afa7c61342188dc Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Thu, 19 May 2016 14:41:20 -0400 Subject: [PATCH 2/6] Add cluster data if present --- lib/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 5020a4c..620289b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -174,9 +174,14 @@ export default class Layer extends EE.EventEmitter { } } }; - if (rules) { + + // temporary till cluster feature is unified (eta july 2016) + if (rules && rules.cluster) { + out.layer.style.cluster = rules.cluster; + } else if (rules) { out.layer.style.rules = rules; } + out.layer.query.where = query; switch (type) { case 'line': From b85369857d511a8fd2e45b3018d0ad015aa65183 Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Thu, 19 May 2016 14:48:22 -0400 Subject: [PATCH 3/6] Add example cluster ruleset --- readme.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/readme.md b/readme.md index 97239e3..2f5a2a5 100644 --- a/readme.md +++ b/readme.md @@ -105,3 +105,41 @@ The constructor takes several options, many of them mandatory } ] ``` + +* a cluster ruleset (pre-unified API - July 2016?) + +```json +{ + styles: [{ + range: [0, 22], + query: [ + { + col: 'ramp', + test: 'Contains', + value: 'EXIT' + } + ], + cluster: { + autoIconEnable: 'false', + clusterCentroid: 'location', + clusterSpacing: 40, + size: 40, + text: { + color: 'white', + size: '9', + text: 'count', + x: 0, + y: 0 + }, + text2: { + color: 'white', + size: '9', + text: 'count', + x: 0, + y: 1 + }, + url: 'https://google.com/clustermarker.png' + } + }] +} +``` From e1e6a5d8723ca7ef8f9178ef8f36785875017335 Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Thu, 19 May 2016 14:49:44 -0400 Subject: [PATCH 4/6] Document markerCluster type --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 2f5a2a5..07031f3 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ The constructor takes several options, many of them mandatory - `account` - `table` - `host` -- `type`: line or point (only needed if type can't be inferred from table name, i.e. ending with `Line` or `Point` like `conditionLine`). +- `type`: `'line'`, `'point'` or `'markerCluster'` (only needed if type can't be inferred from table name, i.e. ending with `Line` or `Point` like `conditionLine`). - `subdomains`: number of different subdomains, since the domains are zero indexed this is one more then the max subdomain. - `minzoom`: default 0. - `maxzoom`: default 20. From cc249c55736be05343c14e22ebf319a4f39e0991 Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Thu, 19 May 2016 15:56:31 -0400 Subject: [PATCH 5/6] Add cluster secondary marker data --- lib/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/index.js b/lib/index.js index 620289b..79d49d2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -178,6 +178,10 @@ export default class Layer extends EE.EventEmitter { // temporary till cluster feature is unified (eta july 2016) if (rules && rules.cluster) { out.layer.style.cluster = rules.cluster; + out.layer.style.url = rules.url; + out.layer.style.height = rules.height; + out.layer.style.width = rules.width; + out.layer.style.colorTransform = rules.colorTransform; } else if (rules) { out.layer.style.rules = rules; } From b6ca0e08872b8daa86e851fd3641d76af970e5fe Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Mon, 23 May 2016 08:39:18 -0400 Subject: [PATCH 6/6] Update readme.md --- readme.md | 63 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/readme.md b/readme.md index 07031f3..35556e2 100644 --- a/readme.md +++ b/readme.md @@ -110,36 +110,41 @@ The constructor takes several options, many of them mandatory ```json { - styles: [{ - range: [0, 22], - query: [ - { - col: 'ramp', - test: 'Contains', - value: 'EXIT' + "styles": [ + { + "range": [ + 0, + 22 + ], + "query": [ + { + "col": "ramp", + "test": "Contains", + "value": "EXIT" + } + ], + "cluster": { + "autoIconEnable": "false", + "clusterCentroid": "location", + "clusterSpacing": 40, + "size": 40, + "text": { + "color": "white", + "size": "9", + "text": "count", + "x": 0, + "y": 0 + }, + "text2": { + "color": "white", + "size": "9", + "text": "count", + "x": 0, + "y": 1 + }, + "url": "https://google.com/clustermarker.png" } - ], - cluster: { - autoIconEnable: 'false', - clusterCentroid: 'location', - clusterSpacing: 40, - size: 40, - text: { - color: 'white', - size: '9', - text: 'count', - x: 0, - y: 0 - }, - text2: { - color: 'white', - size: '9', - text: 'count', - x: 0, - y: 1 - }, - url: 'https://google.com/clustermarker.png' } - }] + ] } ```