From ac05a1a29231f2eda28fda187a1467c14a177efa Mon Sep 17 00:00:00 2001
From: ncastejon <castejon.nicolas@gmail.com>
Date: Mon, 29 Apr 2019 11:58:39 +0200
Subject: [PATCH] Try with WMS

---
 .jsbeautifyrc                                 |  17 +
 .stylelintrc                                  |   8 -
 .stylelintrc.json                             |  12 +
 package-lock.json                             | 457 ++++--------------
 package.json                                  |   6 +-
 .../components/contact/contact.component.html |   5 +-
 .../components/contact/contact.component.scss |   3 +-
 .../dataset-map/dataset-map.component.html    |   8 +-
 .../dataset-map/dataset-map.component.ts      |  35 ++
 .../components/results/results.component.html |  11 +-
 .../services/elasticsearch.service.ts         |  56 +++
 src/app/map/components/map.component.html     |  52 +-
 src/app/map/components/map.component.ts       |  57 ++-
 src/app/map/components/minimap-control.ts     |   2 +-
 src/app/map/services/map.service.ts           | 204 +++++---
 src/app/map/settings.ts                       |   2 +-
 16 files changed, 462 insertions(+), 473 deletions(-)
 create mode 100644 .jsbeautifyrc
 delete mode 100644 .stylelintrc
 create mode 100644 .stylelintrc.json

diff --git a/.jsbeautifyrc b/.jsbeautifyrc
new file mode 100644
index 00000000..6b4e8a6a
--- /dev/null
+++ b/.jsbeautifyrc
@@ -0,0 +1,17 @@
+{
+  "css": {
+    "space_around_selector_separator": true,
+    "indent_size": 2,
+    "newline_between_rules": true,
+    "end_with_newline": true
+  },
+  "html": {
+    "indent_size": 2,
+    "wrap_line_length": 120
+  },
+  "js": {
+    "indent_size": 2,
+    "wrap_line_length": 120
+
+  }
+}
\ No newline at end of file
diff --git a/.stylelintrc b/.stylelintrc
deleted file mode 100644
index 715d9501..00000000
--- a/.stylelintrc
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "extends": "stylelint-config-standard",
-  "rules": {
-    "selector-pseudo-class-no-unknown": [ true, {
-      ignorePseudoClasses: ["ng-deep"],
-    } ]
-  }
-}
\ No newline at end of file
diff --git a/.stylelintrc.json b/.stylelintrc.json
new file mode 100644
index 00000000..431d32ea
--- /dev/null
+++ b/.stylelintrc.json
@@ -0,0 +1,12 @@
+{
+  "extends": "stylelint-config-standard",
+  "rules": {
+    "rule-empty-line-before": null,
+    "selector-pseudo-class-no-unknown": [
+      true,
+      {
+        "ignorePseudoClasses": ["ng-deep"]
+      }
+    ]
+  }
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index d9cac159..387c23e2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "webapp",
-  "version": "2.1.1",
+  "version": "2.1.3",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -761,6 +761,11 @@
         "wgs84": "0.0.0"
       }
     },
+    "@mapbox/geojson-types": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/@mapbox/geojson-types/-/geojson-types-1.0.2.tgz",
+      "integrity": "sha512-e9EBqHHv3EORHrSfbR9DqecPNn+AmuAoQxV6aL8Xu30bJMJR1o8PZLZzpk1Wq7/NfCbuhmakHTPYRhoqLsXRnw=="
+    },
     "@mapbox/jsonlint-lines-primitives": {
       "version": "2.0.2",
       "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz",
@@ -776,11 +781,6 @@
       "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz",
       "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI="
     },
-    "@mapbox/shelf-pack": {
-      "version": "3.2.0",
-      "resolved": "https://registry.npmjs.org/@mapbox/shelf-pack/-/shelf-pack-3.2.0.tgz",
-      "integrity": "sha512-dyQxe6ukILV6qaEvxoKCIwhblgRjYp1ZGlClo4xvfbmxzFO5LYu7Tnrg2AZrRgN7VsSragsGcNjzUe9kCdKHYQ=="
-    },
     "@mapbox/tiny-sdf": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-1.1.0.tgz",
@@ -903,9 +903,9 @@
       }
     },
     "@types/geojson": {
-      "version": "7946.0.5",
-      "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.5.tgz",
-      "integrity": "sha512-rLlMXpd3rdlrp0+xsrda/hFfOpIxgqFcRpk005UKbHtcdFK+QXAjhBAPnvO58qF4O1LdDXrcaiJxMgstCIlcaw==",
+      "version": "7946.0.7",
+      "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.7.tgz",
+      "integrity": "sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ==",
       "dev": true
     },
     "@types/jasmine": {
@@ -930,9 +930,9 @@
       "dev": true
     },
     "@types/mapbox-gl": {
-      "version": "0.47.2",
-      "resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-0.47.2.tgz",
-      "integrity": "sha512-2RYTLUCPWkyh2RtzA8g7J5zybA12WbnKQnGLa+4Em2E6Sb0F/aQPl03nVxNX9URXu0+4fk+7ReGB8Pj07SPoEw==",
+      "version": "0.51.4",
+      "resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-0.51.4.tgz",
+      "integrity": "sha512-+MqOB1O81rBKPE0mobvgfMs7FugtNnZY42y4sOHj/ljyoIiidyAQ+N27Jd5eTZ8arLAMzbxmDJ0s5oukAgZroQ==",
       "dev": true,
       "requires": {
         "@types/geojson": "*"
@@ -1202,11 +1202,6 @@
         "negotiator": "0.6.1"
       }
     },
-    "acorn": {
-      "version": "5.7.3",
-      "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
-      "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw=="
-    },
     "acorn-dynamic-import": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz",
@@ -1364,6 +1359,7 @@
       "version": "1.0.10",
       "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
       "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+      "dev": true,
       "requires": {
         "sprintf-js": "~1.0.2"
       }
@@ -1941,17 +1937,6 @@
         "to-regex": "^3.0.1"
       }
     },
-    "brfs": {
-      "version": "1.6.1",
-      "resolved": "https://registry.npmjs.org/brfs/-/brfs-1.6.1.tgz",
-      "integrity": "sha512-OfZpABRQQf+Xsmju8XE9bDjs+uU4vLREGolP7bDgcpsI17QREyZ4Bl+2KLxxx1kCgA0fAIhKQBaBYh+PEcCqYQ==",
-      "requires": {
-        "quote-stream": "^1.0.1",
-        "resolve": "^1.1.5",
-        "static-module": "^2.2.0",
-        "through2": "^2.0.0"
-      }
-    },
     "brorand": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
@@ -2076,11 +2061,6 @@
       "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==",
       "dev": true
     },
-    "buffer-equal": {
-      "version": "0.0.1",
-      "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz",
-      "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs="
-    },
     "buffer-fill": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
@@ -2660,6 +2640,7 @@
       "version": "1.6.0",
       "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
       "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==",
+      "dev": true,
       "requires": {
         "safe-buffer": "~5.1.1"
       }
@@ -2920,11 +2901,6 @@
       "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=",
       "dev": true
     },
-    "deep-is": {
-      "version": "0.1.3",
-      "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
-      "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ="
-    },
     "default-gateway": {
       "version": "2.7.2",
       "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-2.7.2.tgz",
@@ -3188,14 +3164,6 @@
       "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
       "dev": true
     },
-    "duplexer2": {
-      "version": "0.1.4",
-      "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz",
-      "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=",
-      "requires": {
-        "readable-stream": "^2.0.2"
-      }
-    },
     "duplexify": {
       "version": "3.7.1",
       "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz",
@@ -3420,18 +3388,6 @@
       "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
       "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
     },
-    "escodegen": {
-      "version": "1.9.1",
-      "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.1.tgz",
-      "integrity": "sha512-6hTjO1NAWkHnDk3OqQ4YrCuwwmGHL9S3nPlzBOUG/R44rda3wLNrfvQ5fkSGjyhHFKM7ALPKcKGrwvCLe0lC7Q==",
-      "requires": {
-        "esprima": "^3.1.3",
-        "estraverse": "^4.2.0",
-        "esutils": "^2.0.2",
-        "optionator": "^0.8.1",
-        "source-map": "~0.6.1"
-      }
-    },
     "eslint-scope": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz",
@@ -3442,10 +3398,15 @@
         "estraverse": "^4.1.1"
       }
     },
+    "esm": {
+      "version": "3.2.22",
+      "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.22.tgz",
+      "integrity": "sha512-z8YG7U44L82j1XrdEJcqZOLUnjxco8pO453gKOlaMD1/md1n/5QrscAmYG+oKUspsmDLuBFZrpbxI6aQ67yRxA=="
+    },
     "esprima": {
-      "version": "3.1.3",
-      "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz",
-      "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM="
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz",
+      "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0="
     },
     "esrecurse": {
       "version": "4.2.1",
@@ -3459,12 +3420,14 @@
     "estraverse": {
       "version": "4.2.0",
       "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
-      "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM="
+      "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=",
+      "dev": true
     },
     "esutils": {
       "version": "2.0.2",
       "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
-      "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
+      "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
+      "dev": true
     },
     "etag": {
       "version": "1.8.1",
@@ -3666,11 +3629,6 @@
         }
       }
     },
-    "expect.js": {
-      "version": "0.2.0",
-      "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.2.0.tgz",
-      "integrity": "sha1-EChTPSwcNj90pnlv9X7AUg3tK+E="
-    },
     "express": {
       "version": "4.16.4",
       "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz",
@@ -3727,6 +3685,7 @@
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
       "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+      "dev": true,
       "requires": {
         "is-extendable": "^0.1.0"
       }
@@ -3809,41 +3768,24 @@
       "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
       "dev": true
     },
-    "falafel": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.1.0.tgz",
-      "integrity": "sha1-lrsXdh2rqU9G0AFzizzt86Z/4Gw=",
-      "requires": {
-        "acorn": "^5.0.0",
-        "foreach": "^2.0.5",
-        "isarray": "0.0.1",
-        "object-keys": "^1.0.6"
-      },
-      "dependencies": {
-        "isarray": {
-          "version": "0.0.1",
-          "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
-          "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
-        }
-      }
-    },
     "fast-deep-equal": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
       "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
       "dev": true
     },
+    "fast-diff": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
+      "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
+      "dev": true
+    },
     "fast-json-stable-stringify": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
       "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
       "dev": true
     },
-    "fast-levenshtein": {
-      "version": "2.0.6",
-      "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
-      "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
-    },
     "fastparse": {
       "version": "1.1.2",
       "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz",
@@ -4008,11 +3950,6 @@
         "for-in": "^1.0.1"
       }
     },
-    "foreach": {
-      "version": "2.0.5",
-      "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
-      "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
-    },
     "forever-agent": {
       "version": "0.6.1",
       "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
@@ -4638,11 +4575,6 @@
         "rimraf": "2"
       }
     },
-    "function-bind": {
-      "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
-      "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
-    },
     "gauge": {
       "version": "2.7.4",
       "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
@@ -4861,23 +4793,17 @@
         "minimatch": "~3.0.2"
       }
     },
+    "google-palette": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/google-palette/-/google-palette-1.1.0.tgz",
+      "integrity": "sha512-rg4XQMVYQ83fQUylt2qrzCQ0C06ZrGl3+gh0XIXanyX+7SOkDCtFIn7gV3UMumg/R9HUL1zHtz5Myw3Z5BHCPg=="
+    },
     "graceful-fs": {
       "version": "4.1.15",
       "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
       "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
       "dev": true
     },
-    "gray-matter": {
-      "version": "3.1.1",
-      "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-3.1.1.tgz",
-      "integrity": "sha512-nZ1qjLmayEv0/wt3sHig7I0s3/sJO0dkAaKYQ5YAOApUtYEOonXSFdWvL1khvnZMTvov4UufkqlFsilPnejEXA==",
-      "requires": {
-        "extend-shallow": "^2.0.1",
-        "js-yaml": "^3.10.0",
-        "kind-of": "^5.0.2",
-        "strip-bom-string": "^1.0.0"
-      }
-    },
     "grid-index": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.1.0.tgz",
@@ -4932,14 +4858,6 @@
         "har-schema": "^2.0.0"
       }
     },
-    "has": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
-      "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
-      "requires": {
-        "function-bind": "^1.1.1"
-      }
-    },
     "has-ansi": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
@@ -5562,7 +5480,8 @@
     "is-extendable": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
-      "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik="
+      "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
+      "dev": true
     },
     "is-extglob": {
       "version": "2.1.1",
@@ -5943,6 +5862,7 @@
       "version": "3.12.1",
       "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz",
       "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==",
+      "dev": true,
       "requires": {
         "argparse": "^1.0.7",
         "esprima": "^4.0.0"
@@ -5951,7 +5871,8 @@
         "esprima": {
           "version": "4.0.1",
           "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
-          "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
+          "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+          "dev": true
         }
       }
     },
@@ -6209,7 +6130,8 @@
     "kind-of": {
       "version": "5.1.0",
       "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
-      "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw=="
+      "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
+      "dev": true
     },
     "lcid": {
       "version": "1.0.0",
@@ -6248,15 +6170,6 @@
         "pify": "^3.0.0"
       }
     },
-    "levn": {
-      "version": "0.3.0",
-      "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
-      "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
-      "requires": {
-        "prelude-ls": "~1.1.2",
-        "type-check": "~0.3.2"
-      }
-    },
     "license-webpack-plugin": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/license-webpack-plugin/-/license-webpack-plugin-2.1.0.tgz",
@@ -6426,14 +6339,6 @@
         "yallist": "^2.1.2"
       }
     },
-    "magic-string": {
-      "version": "0.22.5",
-      "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.5.tgz",
-      "integrity": "sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w==",
-      "requires": {
-        "vlq": "^0.2.2"
-      }
-    },
     "make-dir": {
       "version": "1.3.0",
       "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
@@ -6577,34 +6482,32 @@
       }
     },
     "mapbox-gl": {
-      "version": "0.47.0",
-      "resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.47.0.tgz",
-      "integrity": "sha512-y1AlNYMAKaqEtaqni0zOMYj9gTc1gZ0lqLkxXK9iFg5+ZBITc5DL9AcrXhpEXNxUzXKFa7dZkSULyNaqXFQ8yQ==",
+      "version": "0.51.0",
+      "resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.51.0.tgz",
+      "integrity": "sha512-ToV6WJIgdLIKSwLO13pRf5EMeVx4gjdO10akFFxGVwYO/G1nCIZOurKFPIEXbAg0zmZXJD+55HbOIg+AbJICpQ==",
       "requires": {
-        "@mapbox/jsonlint-lines-primitives": "^2.0.1",
+        "@mapbox/geojson-types": "^1.0.2",
+        "@mapbox/jsonlint-lines-primitives": "^2.0.2",
         "@mapbox/mapbox-gl-supported": "^1.4.0",
         "@mapbox/point-geometry": "^0.1.0",
-        "@mapbox/shelf-pack": "^3.1.0",
         "@mapbox/tiny-sdf": "^1.1.0",
         "@mapbox/unitbezier": "^0.0.0",
         "@mapbox/vector-tile": "^1.3.1",
-        "@mapbox/whoots-js": "^3.0.0",
-        "brfs": "^1.4.4",
+        "@mapbox/whoots-js": "^3.1.0",
         "csscolorparser": "~1.0.2",
         "earcut": "^2.1.3",
+        "esm": "^3.0.84",
         "geojson-rewind": "^0.3.0",
-        "geojson-vt": "^3.1.4",
+        "geojson-vt": "^3.2.1",
         "gl-matrix": "^2.6.1",
-        "gray-matter": "^3.0.8",
         "grid-index": "^1.0.0",
         "minimist": "0.0.8",
+        "murmurhash-js": "^1.0.0",
         "pbf": "^3.0.5",
+        "potpack": "^1.0.1",
         "quickselect": "^1.0.0",
         "rw": "^1.3.3",
-        "shuffle-seed": "^1.1.6",
-        "sort-object": "^0.3.2",
-        "supercluster": "^4.0.1",
-        "through2": "^2.0.3",
+        "supercluster": "^4.1.1",
         "tinyqueue": "^1.1.0",
         "vt-pbf": "^3.0.1"
       }
@@ -6687,21 +6590,6 @@
       "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=",
       "dev": true
     },
-    "merge-source-map": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz",
-      "integrity": "sha1-pd5GU42uhNQRTMXqArR3KmNGcB8=",
-      "requires": {
-        "source-map": "^0.5.6"
-      },
-      "dependencies": {
-        "source-map": {
-          "version": "0.5.7",
-          "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
-          "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
-        }
-      }
-    },
     "methods": {
       "version": "1.1.2",
       "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
@@ -6959,6 +6847,11 @@
       "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=",
       "dev": true
     },
+    "murmurhash-js": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz",
+      "integrity": "sha1-sGJ44h/Gw3+lMTcysEEry2rhX1E="
+    },
     "mute-stream": {
       "version": "0.0.7",
       "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
@@ -7384,16 +7277,6 @@
         }
       }
     },
-    "object-inspect": {
-      "version": "1.4.1",
-      "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.4.1.tgz",
-      "integrity": "sha512-wqdhLpfCUbEsoEwl3FXwGyv8ief1k/1aUdIPCqVnupM6e8l63BEJdiF/0swtn04/8p05tG/T0FrpTlfwvljOdw=="
-    },
-    "object-keys": {
-      "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz",
-      "integrity": "sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg=="
-    },
     "object-visit": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
@@ -7524,19 +7407,6 @@
         }
       }
     },
-    "optionator": {
-      "version": "0.8.2",
-      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
-      "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
-      "requires": {
-        "deep-is": "~0.1.3",
-        "fast-levenshtein": "~2.0.4",
-        "levn": "~0.3.0",
-        "prelude-ls": "~1.1.2",
-        "type-check": "~0.3.2",
-        "wordwrap": "~1.0.0"
-      }
-    },
     "original": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
@@ -7916,7 +7786,8 @@
     "path-parse": {
       "version": "1.0.6",
       "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
-      "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
+      "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+      "dev": true
     },
     "path-to-regexp": {
       "version": "0.1.7",
@@ -7934,12 +7805,12 @@
       }
     },
     "pbf": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.1.0.tgz",
-      "integrity": "sha512-/hYJmIsTmh7fMkHAWWXJ5b8IKLWdjdlAFb3IHkRBn1XUhIYBChVGfVwmHEAV3UfXTxsP/AKfYTXTS/dCPxJd5w==",
+      "version": "3.2.0",
+      "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.0.tgz",
+      "integrity": "sha512-98Eh7rsJNJF/Im6XYMLaOW3cLnNyedlOd6hu3iWMD5I7FZGgpw8yN3vQBrmLbLodu7G784Irb9Qsv2yFrxSAGw==",
       "requires": {
-        "ieee754": "^1.1.6",
-        "resolve-protobuf-schema": "^2.0.0"
+        "ieee754": "^1.1.12",
+        "resolve-protobuf-schema": "^2.1.0"
       }
     },
     "pbkdf2": {
@@ -8107,10 +7978,10 @@
       "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
       "dev": true
     },
-    "prelude-ls": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
-      "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
+    "potpack": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.1.tgz",
+      "integrity": "sha512-15vItUAbViaYrmaB/Pbw7z6qX2xENbFSTA7Ii4tgbPtasxm5v6ryKhKtL91tpWovDJzTiZqdwzhcFBCwiMVdVw=="
     },
     "preserve": {
       "version": "0.2.0",
@@ -8118,6 +7989,15 @@
       "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=",
       "dev": true
     },
+    "prettier-linter-helpers": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+      "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+      "dev": true,
+      "requires": {
+        "fast-diff": "^1.1.2"
+      }
+    },
     "process": {
       "version": "0.11.10",
       "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@@ -8379,23 +8259,6 @@
       "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.1.1.tgz",
       "integrity": "sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ=="
     },
-    "quote-stream": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/quote-stream/-/quote-stream-1.0.2.tgz",
-      "integrity": "sha1-hJY/jJwmuULhU/7rU6rnRlK34LI=",
-      "requires": {
-        "buffer-equal": "0.0.1",
-        "minimist": "^1.1.3",
-        "through2": "^2.0.0"
-      },
-      "dependencies": {
-        "minimist": {
-          "version": "1.2.0",
-          "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
-          "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
-        }
-      }
-    },
     "randomatic": {
       "version": "3.1.1",
       "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz",
@@ -8608,13 +8471,6 @@
       "integrity": "sha1-N+mQpvKyGyoRwuakj9QTVpjLqX8=",
       "requires": {
         "esprima": "~1.0.4"
-      },
-      "dependencies": {
-        "esprima": {
-          "version": "1.0.4",
-          "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz",
-          "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0="
-        }
       }
     },
     "reflect-metadata": {
@@ -8791,6 +8647,7 @@
       "version": "1.10.0",
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
       "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==",
+      "dev": true,
       "requires": {
         "path-parse": "^1.0.6"
       }
@@ -9055,11 +8912,6 @@
         }
       }
     },
-    "seedrandom": {
-      "version": "2.4.4",
-      "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.4.tgz",
-      "integrity": "sha512-9A+PDmgm+2du77B5i0Ip2cxOqqHjgNxnBgglxLcX78A2D6c2rTo61z4jnVABpF4cKeDMDG+cmXXvdnqse2VqMA=="
-    },
     "select-hose": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
@@ -9235,22 +9087,14 @@
         "mixin-object": "^2.0.1"
       }
     },
-    "shallow-copy": {
-      "version": "0.0.1",
-      "resolved": "https://registry.npmjs.org/shallow-copy/-/shallow-copy-0.0.1.tgz",
-      "integrity": "sha1-QV9CcC1z2BAzApLMXuhurhoRoXA="
-    },
     "sharkdown": {
-      "version": "0.1.0",
-      "resolved": "https://registry.npmjs.org/sharkdown/-/sharkdown-0.1.0.tgz",
-      "integrity": "sha1-YdT+Up510CRCEnzJI0NiJlCZIU8=",
+      "version": "0.1.1",
+      "resolved": "https://registry.npmjs.org/sharkdown/-/sharkdown-0.1.1.tgz",
+      "integrity": "sha512-exwooSpmo5s45lrexgz6Q0rFQM574wYIX3iDZ7RLLqOb7IAoQZu9nxlZODU972g19sR69OIpKP2cpHTzU+PHIg==",
       "requires": {
         "cardinal": "~0.4.2",
-        "expect.js": "~0.2.0",
         "minimist": "0.0.5",
-        "split": "~0.2.10",
-        "stream-spigot": "~2.1.2",
-        "through": "~2.3.4"
+        "split": "~0.2.10"
       },
       "dependencies": {
         "minimist": {
@@ -9286,14 +9130,6 @@
         "rechoir": "^0.6.2"
       }
     },
-    "shuffle-seed": {
-      "version": "1.1.6",
-      "resolved": "https://registry.npmjs.org/shuffle-seed/-/shuffle-seed-1.1.6.tgz",
-      "integrity": "sha1-UzwSaDurO0+j6HUfxOViFGdEJgs=",
-      "requires": {
-        "seedrandom": "^2.4.2"
-      }
-    },
     "signal-exit": {
       "version": "3.0.2",
       "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
@@ -9583,25 +9419,6 @@
         "socks": "~2.2.0"
       }
     },
-    "sort-asc": {
-      "version": "0.1.0",
-      "resolved": "https://registry.npmjs.org/sort-asc/-/sort-asc-0.1.0.tgz",
-      "integrity": "sha1-q3md9h/HPqCVbHnEtTHtHp53J+k="
-    },
-    "sort-desc": {
-      "version": "0.1.1",
-      "resolved": "https://registry.npmjs.org/sort-desc/-/sort-desc-0.1.1.tgz",
-      "integrity": "sha1-GYuMDN6wlcRjNBhh45JdTuNZqe4="
-    },
-    "sort-object": {
-      "version": "0.3.2",
-      "resolved": "https://registry.npmjs.org/sort-object/-/sort-object-0.3.2.tgz",
-      "integrity": "sha1-mODRme3kDgfGGoRAPGHWw7KQ+eI=",
-      "requires": {
-        "sort-asc": "^0.1.0",
-        "sort-desc": "^0.1.1"
-      }
-    },
     "source-list-map": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
@@ -9611,7 +9428,8 @@
     "source-map": {
       "version": "0.6.1",
       "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
-      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+      "dev": true
     },
     "source-map-loader": {
       "version": "0.2.4",
@@ -9843,7 +9661,8 @@
     "sprintf-js": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
-      "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
+      "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+      "dev": true
     },
     "sshpk": {
       "version": "1.16.1",
@@ -9871,14 +9690,6 @@
         "safe-buffer": "^5.1.1"
       }
     },
-    "static-eval": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-2.0.0.tgz",
-      "integrity": "sha512-6flshd3F1Gwm+Ksxq463LtFd1liC77N/PX1FVVc3OzL3hAmo2fwHFbuArkcfi7s9rTNsLEhcRmXGFZhlgy40uw==",
-      "requires": {
-        "escodegen": "^1.8.1"
-      }
-    },
     "static-extend": {
       "version": "0.1.2",
       "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
@@ -9900,27 +9711,6 @@
         }
       }
     },
-    "static-module": {
-      "version": "2.2.5",
-      "resolved": "https://registry.npmjs.org/static-module/-/static-module-2.2.5.tgz",
-      "integrity": "sha512-D8vv82E/Kpmz3TXHKG8PPsCPg+RAX6cbCOyvjM6x04qZtQ47EtJFVwRsdov3n5d6/6ynrOY9XB4JkaZwB2xoRQ==",
-      "requires": {
-        "concat-stream": "~1.6.0",
-        "convert-source-map": "^1.5.1",
-        "duplexer2": "~0.1.4",
-        "escodegen": "~1.9.0",
-        "falafel": "^2.1.0",
-        "has": "^1.0.1",
-        "magic-string": "^0.22.4",
-        "merge-source-map": "1.0.4",
-        "object-inspect": "~1.4.0",
-        "quote-stream": "~1.0.2",
-        "readable-stream": "~2.3.3",
-        "shallow-copy": "~0.0.1",
-        "static-eval": "^2.0.0",
-        "through2": "~2.0.3"
-      }
-    },
     "stats-webpack-plugin": {
       "version": "0.7.0",
       "resolved": "https://registry.npmjs.org/stats-webpack-plugin/-/stats-webpack-plugin-0.7.0.tgz",
@@ -9985,37 +9775,6 @@
       "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=",
       "dev": true
     },
-    "stream-spigot": {
-      "version": "2.1.2",
-      "resolved": "https://registry.npmjs.org/stream-spigot/-/stream-spigot-2.1.2.tgz",
-      "integrity": "sha1-feFF6Bn43Q20UJDRPc9zqO08wDU=",
-      "requires": {
-        "readable-stream": "~1.1.0"
-      },
-      "dependencies": {
-        "isarray": {
-          "version": "0.0.1",
-          "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
-          "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
-        },
-        "readable-stream": {
-          "version": "1.1.14",
-          "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
-          "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
-          "requires": {
-            "core-util-is": "~1.0.0",
-            "inherits": "~2.0.1",
-            "isarray": "0.0.1",
-            "string_decoder": "~0.10.x"
-          }
-        },
-        "string_decoder": {
-          "version": "0.10.31",
-          "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
-          "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
-        }
-      }
-    },
     "streamroller": {
       "version": "0.7.0",
       "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz",
@@ -10094,11 +9853,6 @@
         "is-utf8": "^0.2.0"
       }
     },
-    "strip-bom-string": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz",
-      "integrity": "sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI="
-    },
     "strip-eof": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
@@ -10146,6 +9900,15 @@
         "stylelint-config-recommended": "^2.2.0"
       }
     },
+    "stylelint-prettier": {
+      "version": "1.0.6",
+      "resolved": "https://registry.npmjs.org/stylelint-prettier/-/stylelint-prettier-1.0.6.tgz",
+      "integrity": "sha512-XKlTyJHJYiyXs9JXRMt2FQxMJoBSjz4I6+4+/R3o8/ePof19v9naC4d0zsMKUJ88by81+qHfqXBLfmAalu46cg==",
+      "dev": true,
+      "requires": {
+        "prettier-linter-helpers": "^1.0.0"
+      }
+    },
     "stylus": {
       "version": "0.54.5",
       "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.54.5.tgz",
@@ -10414,6 +10177,7 @@
       "version": "2.0.5",
       "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
       "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==",
+      "dev": true,
       "requires": {
         "readable-stream": "~2.3.6",
         "xtend": "~4.0.1"
@@ -10812,14 +10576,6 @@
       "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
       "dev": true
     },
-    "type-check": {
-      "version": "0.3.2",
-      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
-      "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
-      "requires": {
-        "prelude-ls": "~1.1.2"
-      }
-    },
     "type-is": {
       "version": "1.6.16",
       "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
@@ -11084,11 +10840,6 @@
         "extsprintf": "^1.2.0"
       }
     },
-    "vlq": {
-      "version": "0.2.3",
-      "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz",
-      "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow=="
-    },
     "vm-browserify": {
       "version": "0.0.4",
       "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz",
@@ -11689,11 +11440,6 @@
         "string-width": "^1.0.2 || 2"
       }
     },
-    "wordwrap": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
-      "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
-    },
     "worker-farm": {
       "version": "1.6.0",
       "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz",
@@ -11781,7 +11527,8 @@
     "xtend": {
       "version": "4.0.1",
       "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
-      "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
+      "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
+      "dev": true
     },
     "y18n": {
       "version": "4.0.0",
diff --git a/package.json b/package.json
index b5e1304e..833005f3 100644
--- a/package.json
+++ b/package.json
@@ -40,10 +40,11 @@
     "bulma-tooltip": "^2.0.2",
     "core-js": "^2.5.7",
     "font-awesome": "^4.7.0",
+    "google-palette": "^1.1.0",
     "hamburgers": "^1.1.3",
     "jwt-decode": "^2.2.0",
     "lodash.clonedeep": "^4.5.0",
-    "mapbox-gl": "^0.47.0",
+    "mapbox-gl": "^0.51.0",
     "ng-inline-svg": "^8.2.1",
     "ng-lazyload-image": "^5.1.2",
     "ngx-cookie-service": "^2.1.0",
@@ -61,7 +62,7 @@
     "@types/jasmine": "^2.8.12",
     "@types/jasminewd2": "^2.0.6",
     "@types/jwt-decode": "^2.2.1",
-    "@types/mapbox-gl": "^0.47.0",
+    "@types/mapbox-gl": "^0.51.0",
     "@types/node": "^6.14.2",
     "codelyzer": "^4.5.0",
     "jasmine-core": "~2.8.0",
@@ -78,6 +79,7 @@
     "sass-recursive-map-merge": "^1.0.1",
     "stylelint-config-recommended": "^2.2.0",
     "stylelint-config-standard": "^18.3.0",
+    "stylelint-prettier": "^1.0.6",
     "ts-node": "~4.1.0",
     "tslint": "^5.12.1",
     "tslint-config-airbnb": "^5.11.1",
diff --git a/src/app/core/components/contact/contact.component.html b/src/app/core/components/contact/contact.component.html
index 26a5b039..a1005a5c 100644
--- a/src/app/core/components/contact/contact.component.html
+++ b/src/app/core/components/contact/contact.component.html
@@ -211,7 +211,8 @@
             January 6, 1978, you have the right to access and rectify information that
             concerns you. To exercise this right and be transfered the information concerning
             you, please contact: Lyon Métropole - Direction des
-            Affaires Juridiques et de la Commande Publique - 20 Rue du Lac - BP 33569 - 69505 Lyon Cedex 03, by postal mail
+            Affaires Juridiques et de la Commande Publique - 20 Rue du Lac - BP 33569 - 69505 Lyon Cedex 03, by postal
+            mail
             or using the appropriate form on this portal. You may also oppose processing of
             your personal data for a legitimate reason. In this case, we will not be able to
             process the request submitted using this form.
@@ -238,4 +239,4 @@
       </div>
     </div>
   </form>
-</div>
+</div>
\ No newline at end of file
diff --git a/src/app/core/components/contact/contact.component.scss b/src/app/core/components/contact/contact.component.scss
index 54044c23..ea8bb801 100644
--- a/src/app/core/components/contact/contact.component.scss
+++ b/src/app/core/components/contact/contact.component.scss
@@ -1,4 +1,4 @@
-@import '../../../../scss/variables.scss';
+@import "../../../../scss/variables.scss";
 @import "../../../../../node_modules/bulma/sass/utilities/_all";
 
 h1 {
@@ -78,6 +78,7 @@ h3 {
 }
 
 .title-label.is-danger {
+
   &:hover,
   &:focus {
     background-color: white;
diff --git a/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.html b/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.html
index b6e169e6..e2c2b00e 100644
--- a/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.html
+++ b/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.html
@@ -1,3 +1,7 @@
-<div>
-  <app-map></app-map>
+<input type="text" (keyup)="keyUpChanged($event.target.value)" />
+
+<button (click)="showByGenre()">Colorer par genre</button>
+
+<div *ngIf="metadata">
+  <app-map [metadata]="metadata" [filterSearch]="filterSearch" [aggregationsFilter]="aggregationsFilter"></app-map>
 </div>
diff --git a/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts b/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts
index f0d0dc1c..7e4870c2 100644
--- a/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts
+++ b/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts
@@ -1,5 +1,9 @@
 import { Component, OnInit, OnDestroy } from '@angular/core';
 import { MapService } from '../../../../map/services/map.service';
+import { DatasetDetailService, ElasticsearchService } from '../../../services';
+import { Subscription, Subject } from 'rxjs';
+import { Metadata } from '../../../models';
+import { debounceTime } from 'rxjs/operators';
 
 @Component({
   selector: 'app-dataset-map',
@@ -10,17 +14,48 @@ import { MapService } from '../../../../map/services/map.service';
 export class DatasetMapComponent implements OnInit {
 
   mapLoaded: boolean;
+  datasetSub: Subscription; // Subscription to dataset change
+  metadata: Metadata;
+  aggregationsFilter: any[];
+
+  filterSearch: string;
+  keyUpSubject: Subject<string> = new Subject<string>();
 
   constructor(
     private _mapService: MapService,
+    private _datasetDetailService: DatasetDetailService,
+    private _elasticSearchService: ElasticsearchService,
   ) { }
 
   ngOnInit() {
+    this.metadata = this._datasetDetailService.datasetMetadata;
+
+    this.keyUpSubject.pipe(debounceTime(500)).subscribe((key) => {
+      this.filterSearch = key;
+    });
+
+    // Subcribe to the dataset changes in the service. When the dataset is loaded
+    // (with the metadata), we construct the map and display the features
+    this.datasetSub = this._datasetDetailService.dataset$.subscribe(() => {
+      this.metadata = this._datasetDetailService.datasetMetadata;
+    });
+
     this._mapService.map$.subscribe(() => {
       this.mapLoaded = true;
     });
   }
 
+  keyUpChanged(key: string) {
+    this.keyUpSubject.next(key);
+  }
+
+  showByGenre() {
+    this._elasticSearchService.getDataAggregations(this.metadata.dataset_id, 'data-fr.properties.genre')
+      .subscribe((aggregations) => {
+        this.aggregationsFilter = aggregations;
+      });
+  }
+
   // Generate the url with map options
   // http://hostName#zoom/latitude/longitude/bearing/pitch
   getPermalinkUrl() {
diff --git a/src/app/geosource/components/results/results.component.html b/src/app/geosource/components/results/results.component.html
index 8f440ed8..e97e9fb2 100644
--- a/src/app/geosource/components/results/results.component.html
+++ b/src/app/geosource/components/results/results.component.html
@@ -2,19 +2,22 @@
   <div class="filter-button-touch column is-hidden-desktop has-text-centered">
     <a (click)="toggleFilters()" i18n="@@global.filter">Filter</a>
   </div>
-  <div class="column is-3-desktop is-12-touch is-hidden-touch filter-column" [ngClass]="{'is-hidden-touch': displayFilters === false}">
+  <div class="column is-3-desktop is-12-touch is-hidden-touch filter-column"
+    [ngClass]="{'is-hidden-touch': displayFilters === false}">
     <app-filter-list></app-filter-list>
   </div>
   <div class="column is-9-desktop is-12-touch results-column" *ngIf="results">
 
     <div class="tab-results">
-      <app-results-tab-scope [countResults]="countResults" [selectedScope]="selectedScope" (scopeChanged)="scopeChanged($event)">
+      <app-results-tab-scope [countResults]="countResults" [selectedScope]="selectedScope"
+        (scopeChanged)="scopeChanged($event)">
       </app-results-tab-scope>
     </div>
 
     <!-- If we have results, display the pagination and count results
           If not, display one message indicating no result was found -->
-    <div class="columns is-multiline is-vcentered is-marginless header-results" *ngIf="countResults[selectedScope.key]; else noResult">
+    <div class="columns is-multiline is-vcentered is-marginless header-results"
+      *ngIf="countResults[selectedScope.key]; else noResult">
       <div class="column is-12-touch" *ngIf="paginator.length">
         <span>{{ fromResultNumber }} - {{ toResultNumber }} </span>
         <span i18n="@@global.resultsFound">to {{ paginator.length }} results found</span>
@@ -78,4 +81,4 @@
       </app-paginator>
     </div>
   </div>
-</div>
+</div>
\ No newline at end of file
diff --git a/src/app/geosource/services/elasticsearch.service.ts b/src/app/geosource/services/elasticsearch.service.ts
index 431820ea..2a7e86e3 100644
--- a/src/app/geosource/services/elasticsearch.service.ts
+++ b/src/app/geosource/services/elasticsearch.service.ts
@@ -1128,4 +1128,60 @@ export class ElasticsearchService {
       ),
     );
   }
+
+  getDataAggregations(datasetId: string, field: string) {
+    const request = {
+      body: {
+        size: 0,
+        from: 10,
+        query: {
+          bool: {
+            must: [
+              {
+                query_string: {
+                  query: 'c1b069ca-181d-4265-9838-8d182f207bd3',
+                  default_field: 'data_and_metadata',
+                },
+              },
+            ],
+          },
+        },
+        aggregations: {
+          'data-fr.properties.genre': {
+            terms: {
+              field: `${field}.keyword`,
+              order: {
+                _key: 'asc',
+              },
+              size: 500,
+            },
+            aggs: {
+              count: {
+                cardinality: {
+                  field: `${field}.keyword`,
+                },
+              },
+
+            },
+          },
+        },
+      },
+    };
+    return this._http.request<IElasticsearchResponse>('POST', this.elasticSearchUrl, request).pipe(
+      map((e) => {
+        const dataAggregations = [];
+        if (e.aggregations[field].buckets) {
+          e.aggregations[field].buckets.forEach((e) => {
+            dataAggregations.push(e.key);
+          });
+        }
+        return dataAggregations;
+      }),
+      catchError(
+        (err) => {
+          throw this._errorService.handleError(err, { message: notificationMessages.geosource.getResults });
+        },
+      ),
+    );
+  }
 }
diff --git a/src/app/map/components/map.component.html b/src/app/map/components/map.component.html
index 0a67388a..90755705 100644
--- a/src/app/map/components/map.component.html
+++ b/src/app/map/components/map.component.html
@@ -1,11 +1,13 @@
 <div>
-  <div id="map" class="mapbox-map" [ngClass]="{'fullscreen': fullscreen===true, 'display-details': selectedData !== null && displayDataDetails === true, 'hide-details': displayDataDetails === false && selectedData !== null}">
+  <div id="map" class="mapbox-map"
+    [ngClass]="{'fullscreen': fullscreen===true, 'display-details': selectedData !== null && displayDataDetails === true, 'hide-details': displayDataDetails === false && selectedData !== null}">
     <div id="menu" *ngIf="displayControls">
       <div class="columns is-mobile is-marginless">
         <div class="column is-narrow">
           <div class="buttons has-addons column-content">
             <ng-container *ngFor="let l of settings.baseLayers">
-              <button class="button" [disabled]="l.id === selectedBaseLayer.id" [ngClass]="{'is-selected': l.id === selectedBaseLayer.id, 'is-danger': l.id === selectedBaseLayer.id}"
+              <button class="button" [disabled]="l.id === selectedBaseLayer.id"
+                [ngClass]="{'is-selected': l.id === selectedBaseLayer.id, 'is-danger': l.id === selectedBaseLayer.id}"
                 (click)="switchLayer(l)" type="button">
                 {{ l.labels[lang] }}
               </button>
@@ -14,10 +16,29 @@
         </div>
       </div>
 
+      <div class="columns is-mobile is-marginless">
+        <div class="column is-narrow">
+          <div class="buttons has-addons column-content">
+            <button class="button" [disabled]="'WFS' === currentLayerType" *ngIf="availableLayers.includes('WFS')"
+              [ngClass]="{'is-selected':  'WFS' === currentLayerType, 
+              'is-danger': 'WFS' === currentLayerType}" (click)="switchSourceLayer('WFS')" type="button">
+              WFS
+            </button>
+            <button class="button" [disabled]="'WMS' === currentLayerType" *ngIf="availableLayers.includes('WMS')"
+              [ngClass]="{'is-selected':'WMS' === currentLayerType,
+              'is-danger': 'WMS' === currentLayerType}" (click)="switchSourceLayer('WMS')" type="button">
+              WMS
+            </button>
+          </div>
+        </div>
+      </div>
+
+
       <div class="columns is-mobile is-marginless">
         <div class="column">
           <div class="mapboxgl-ctrl-group column-content">
-            <button class="mapboxgl-ctrl-icon" [ngClass]="{'btn-exit-fullscreen': fullscreen === true, 'btn-fullscreen': fullscreen === false}"
+            <button class="mapboxgl-ctrl-icon"
+              [ngClass]="{'btn-exit-fullscreen': fullscreen === true, 'btn-fullscreen': fullscreen === false}"
               type="button" (click)="toogleFullscreen()">
             </button>
           </div>
@@ -40,20 +61,25 @@
     </div>
 
     <div class="copy-map">
-        <input type="text" class="input" id="mapUrlCopy"
-        [value]="mapUrl()" #mapUrlElement>
+      <input type="text" class="input" id="mapUrlCopy" [value]="mapUrl()" #mapUrlElement>
       <button type="button" (click)="copyMaplink(mapUrlElement)" class="button is-medium">
-          {{zoom()}}
-          <svg xmlns="http://www.w3.org/2000/svg" id="copy" viewBox="0 0 18 18">
-            <path d="M11.1 7.1c.6.6 1 1.3 1.2 2.2s.2 1.6 0 2.4-.6 1.5-1.2 2.1L8.9 16c-.6.6-1.3 1-2.1 1.2-.8.2-1.6.2-2.4 0-.8-.2-1.5-.6-2.2-1.3-.6-.6-1-1.3-1.2-2.1-.2-.8-.2-1.6 0-2.4.2-.8.6-1.5 1.2-2.1l1.2-1.2c.2-.2.3-.2.5-.1s.3.2.3.4c0 .6.1 1.1.3 1.7.1.2 0 .4-.1.5L4 11c-.4.4-.7 1-.7 1.6 0 .6.2 1.1.7 1.6.4.4 1 .7 1.6.7s1.2-.2 1.6-.7l2.1-2.1c.4-.4.7-1 .7-1.6s-.3-1.1-.7-1.6c-.1-.1-.2-.2-.4-.3s-.1-.2-.1-.3c0-.4.1-.7.3-.9l.7-.7c.1-.1.2-.1.3-.1.1 0 .2 0 .3.1.2.1.5.2.7.4zm4.4-4.4c-.6-.6-1.3-1-2.2-1.2-.8-.2-1.6-.2-2.4 0-.8.2-1.5.6-2.1 1.2L6.6 4.9c-.6.6-1 1.3-1.2 2.1s-.2 1.6 0 2.4.6 1.5 1.2 2.2c.2.2.4.4.7.5.1.1.2.1.3.1.1 0 .2-.1.3-.2l.7-.7c.2-.2.4-.6.3-.9 0-.2-.1-.3-.2-.4s-.2-.1-.3-.2c-.4-.4-.6-1-.6-1.6S8 7 8.4 6.6l2.1-2.1c.4-.4 1-.7 1.6-.7s1.2.2 1.6.7c.4.4.6 1 .6 1.6 0 .6-.2 1.1-.7 1.6l-.4.4c-.1.1-.2.3-.1.5.2.5.3 1.1.3 1.7 0 .2.1.4.3.4.2.1.4.1.5-.1l1.2-1.2c.6-.6 1-1.3 1.2-2.1.2-.8.2-1.6 0-2.4-.1-.8-.5-1.5-1.1-2.2z" class="grey"/>
-            <path d="M11.1 7.1c.6.6 1 1.3 1.2 2.2s.2 1.6 0 2.4-.6 1.5-1.2 2.1L8.9 16c-.6.6-1.3 1-2.1 1.2-.8.2-1.6.2-2.4 0-.8-.2-1.5-.6-2.2-1.3-.6-.6-1-1.3-1.2-2.1-.2-.8-.2-1.6 0-2.4.2-.8.6-1.5 1.2-2.1l1.2-1.2c.2-.2.3-.2.5-.1s.3.2.3.4c0 .6.1 1.1.3 1.7.1.2 0 .4-.1.5L4 11c-.4.4-.7 1-.7 1.6 0 .6.2 1.1.7 1.6.4.4 1 .7 1.6.7s1.2-.2 1.6-.7l2.1-2.1c.4-.4.7-1 .7-1.6s-.3-1.1-.7-1.6c-.1-.1-.2-.2-.4-.3s-.1-.2-.1-.3c0-.4.1-.7.3-.9l.7-.7c.1-.1.2-.1.3-.1.1 0 .2 0 .3.1.2.1.5.2.7.4zm4.4-4.4c-.6-.6-1.3-1-2.2-1.2-.8-.2-1.6-.2-2.4 0-.8.2-1.5.6-2.1 1.2L6.6 4.9c-.6.6-1 1.3-1.2 2.1s-.2 1.6 0 2.4.6 1.5 1.2 2.2c.2.2.4.4.7.5.1.1.2.1.3.1.1 0 .2-.1.3-.2l.7-.7c.2-.2.4-.6.3-.9 0-.2-.1-.3-.2-.4s-.2-.1-.3-.2c-.4-.4-.6-1-.6-1.6S8 7 8.4 6.6l2.1-2.1c.4-.4 1-.7 1.6-.7s1.2.2 1.6.7c.4.4.6 1 .6 1.6 0 .6-.2 1.1-.7 1.6l-.4.4c-.1.1-.2.3-.1.5.2.5.3 1.1.3 1.7 0 .2.1.4.3.4.2.1.4.1.5-.1l1.2-1.2c.6-.6 1-1.3 1.2-2.1.2-.8.2-1.6 0-2.4-.1-.8-.5-1.5-1.1-2.2z" class="grey"/>
-          </svg>
+        {{zoom()}}
+        <svg xmlns="http://www.w3.org/2000/svg" id="copy" viewBox="0 0 18 18">
+          <path
+            d="M11.1 7.1c.6.6 1 1.3 1.2 2.2s.2 1.6 0 2.4-.6 1.5-1.2 2.1L8.9 16c-.6.6-1.3 1-2.1 1.2-.8.2-1.6.2-2.4 0-.8-.2-1.5-.6-2.2-1.3-.6-.6-1-1.3-1.2-2.1-.2-.8-.2-1.6 0-2.4.2-.8.6-1.5 1.2-2.1l1.2-1.2c.2-.2.3-.2.5-.1s.3.2.3.4c0 .6.1 1.1.3 1.7.1.2 0 .4-.1.5L4 11c-.4.4-.7 1-.7 1.6 0 .6.2 1.1.7 1.6.4.4 1 .7 1.6.7s1.2-.2 1.6-.7l2.1-2.1c.4-.4.7-1 .7-1.6s-.3-1.1-.7-1.6c-.1-.1-.2-.2-.4-.3s-.1-.2-.1-.3c0-.4.1-.7.3-.9l.7-.7c.1-.1.2-.1.3-.1.1 0 .2 0 .3.1.2.1.5.2.7.4zm4.4-4.4c-.6-.6-1.3-1-2.2-1.2-.8-.2-1.6-.2-2.4 0-.8.2-1.5.6-2.1 1.2L6.6 4.9c-.6.6-1 1.3-1.2 2.1s-.2 1.6 0 2.4.6 1.5 1.2 2.2c.2.2.4.4.7.5.1.1.2.1.3.1.1 0 .2-.1.3-.2l.7-.7c.2-.2.4-.6.3-.9 0-.2-.1-.3-.2-.4s-.2-.1-.3-.2c-.4-.4-.6-1-.6-1.6S8 7 8.4 6.6l2.1-2.1c.4-.4 1-.7 1.6-.7s1.2.2 1.6.7c.4.4.6 1 .6 1.6 0 .6-.2 1.1-.7 1.6l-.4.4c-.1.1-.2.3-.1.5.2.5.3 1.1.3 1.7 0 .2.1.4.3.4.2.1.4.1.5-.1l1.2-1.2c.6-.6 1-1.3 1.2-2.1.2-.8.2-1.6 0-2.4-.1-.8-.5-1.5-1.1-2.2z"
+            class="grey" />
+          <path
+            d="M11.1 7.1c.6.6 1 1.3 1.2 2.2s.2 1.6 0 2.4-.6 1.5-1.2 2.1L8.9 16c-.6.6-1.3 1-2.1 1.2-.8.2-1.6.2-2.4 0-.8-.2-1.5-.6-2.2-1.3-.6-.6-1-1.3-1.2-2.1-.2-.8-.2-1.6 0-2.4.2-.8.6-1.5 1.2-2.1l1.2-1.2c.2-.2.3-.2.5-.1s.3.2.3.4c0 .6.1 1.1.3 1.7.1.2 0 .4-.1.5L4 11c-.4.4-.7 1-.7 1.6 0 .6.2 1.1.7 1.6.4.4 1 .7 1.6.7s1.2-.2 1.6-.7l2.1-2.1c.4-.4.7-1 .7-1.6s-.3-1.1-.7-1.6c-.1-.1-.2-.2-.4-.3s-.1-.2-.1-.3c0-.4.1-.7.3-.9l.7-.7c.1-.1.2-.1.3-.1.1 0 .2 0 .3.1.2.1.5.2.7.4zm4.4-4.4c-.6-.6-1.3-1-2.2-1.2-.8-.2-1.6-.2-2.4 0-.8.2-1.5.6-2.1 1.2L6.6 4.9c-.6.6-1 1.3-1.2 2.1s-.2 1.6 0 2.4.6 1.5 1.2 2.2c.2.2.4.4.7.5.1.1.2.1.3.1.1 0 .2-.1.3-.2l.7-.7c.2-.2.4-.6.3-.9 0-.2-.1-.3-.2-.4s-.2-.1-.3-.2c-.4-.4-.6-1-.6-1.6S8 7 8.4 6.6l2.1-2.1c.4-.4 1-.7 1.6-.7s1.2.2 1.6.7c.4.4.6 1 .6 1.6 0 .6-.2 1.1-.7 1.6l-.4.4c-.1.1-.2.3-.1.5.2.5.3 1.1.3 1.7 0 .2.1.4.3.4.2.1.4.1.5-.1l1.2-1.2c.6-.6 1-1.3 1.2-2.1.2-.8.2-1.6 0-2.4-.1-.8-.5-1.5-1.1-2.2z"
+            class="grey" />
+        </svg>
         <span class="is-hidden-touch">{{ shareMessage }}</span>
       </button>
     </div>
 
-    <div class="data-details-wrapper" *ngIf="selectedData !== null" [ngClass]="{'data-details-opened': selectedData !== null && displayDataDetails === true, 'data-details-closed': displayDataDetails === false}">
-      <app-data-details (close)="closeDataDetails()" [properties]="selectedData" class="app-data-details"></app-data-details>
+    <div class="data-details-wrapper" *ngIf="selectedData !== null"
+      [ngClass]="{'data-details-opened': selectedData !== null && displayDataDetails === true, 'data-details-closed': displayDataDetails === false}">
+      <app-data-details (close)="closeDataDetails()" [properties]="selectedData" class="app-data-details">
+      </app-data-details>
     </div>
   </div>
-</div>
+</div>
\ No newline at end of file
diff --git a/src/app/map/components/map.component.ts b/src/app/map/components/map.component.ts
index e5d3d5cb..060b89e3 100644
--- a/src/app/map/components/map.component.ts
+++ b/src/app/map/components/map.component.ts
@@ -1,8 +1,6 @@
-import { Component, OnInit, OnDestroy, EventEmitter, Output } from '@angular/core';
+import { Component, OnInit, OnDestroy, Input } from '@angular/core';
 import * as mapboxgl from 'mapbox-gl';
-import { Subscription } from 'rxjs';
 import { Metadata } from '../../geosource/models';
-import { DatasetDetailService } from '../../geosource/services';
 import { MapService } from '../services/map.service';
 import { settings } from '../settings';
 import { geosource } from '../../../i18n/traductions';
@@ -16,13 +14,14 @@ import { linkFormats } from '../../geosource/models/metadata.model';
 
 export class MapComponent implements OnInit, OnDestroy {
 
+  @Input() metadata: Metadata;
+  @Input() aggregationsFilter: string[];
+  @Input() filterSearch: string;
+
   settings = settings;
   linkFormats = linkFormats;
   lang: string; // (fr or en)
 
-  metadata: Metadata;
-  sub: Subscription; // Subscription to dataset change
-
   map: mapboxgl.Map;
 
   shareMessage: string = geosource.mapMessages.share;
@@ -35,6 +34,7 @@ export class MapComponent implements OnInit, OnDestroy {
 
   previousDatasetId: string;
   currentLayerType: string;
+  availableLayers: string[];
 
   baseLayer3d = 1;
   displayControls = false;
@@ -43,13 +43,12 @@ export class MapComponent implements OnInit, OnDestroy {
   fullscreen = false;
 
   constructor(
-    private _datasetDetailService: DatasetDetailService,
     private _mapService: MapService,
   ) { }
 
   ngOnInit() {
     this.initilizeLanguage();
-
+    this.initAvailableLayers();
     this.constructMap();
 
     // Events received here contain a state (if the data-detail panel has to be displayed or not)
@@ -60,33 +59,48 @@ export class MapComponent implements OnInit, OnDestroy {
         this.selectedData = dataDetails.properties;
       }
     });
+  }
 
-    // Subcribe to the dataset changes in the service. When the dataset is loaded
-    // (with the metadata), we construct the map and display the features
-    this.sub = this._datasetDetailService.dataset$.subscribe(() => {
-      this.constructMap();
-    });
+  ngOnChanges() {
+    if (this.filterSearch) {
+      // this._mapService.updateFilter(this.filterSearch);
+    }
+
+    if (this.aggregationsFilter) {
+      this._mapService.updateAggregationFilter(this.aggregationsFilter);
+    }
   }
 
   // To avoid call the constructMap when we left the component
   // (because this is a custom observable, this is not automatically unsubscribed
   // when the component is destroyed)
   ngOnDestroy() {
-    this.sub.unsubscribe();
     this._mapService.destroyMap();
   }
 
+  initAvailableLayers() {
+    this.availableLayers = [];
+    this.metadata.link.forEach((link) => {
+      this.availableLayers.push(link.service);
+    });
+    if (this.availableLayers.includes(linkFormats.wfs)) {
+      this.currentLayerType = linkFormats.wfs;
+    } else {
+      this.currentLayerType = linkFormats.wms;
+    }
+
+  }
+
   // When we get a metadata, we display the following:
   // - load Mapbox style file to get the styles and the base layers (vector, plan, satellite)
   constructMap() {
-    this.metadata = this._datasetDetailService.datasetMetadata;
 
     if (this.metadata) {
 
       // Set the basic and default options
       const options = {
         container: 'map',
-        center: [4.85, 45.75],
+        center: [4.85, 45.75] as mapboxgl.LngLatLike,
         zoom: 12,
         maxZoom: 21,
       };
@@ -130,7 +144,7 @@ export class MapComponent implements OnInit, OnDestroy {
 
       // Create the map with the associated style Mapbox file
       this.displayControls = true;
-      this.map = this._mapService.createMap(url, this.selectedBaseLayer, this.displayControls, options);
+      this.map = this._mapService.createMap(this.metadata, url, this.selectedBaseLayer, this.displayControls, options);
 
       // We create and add the layers (WMS/WFS) when the base layer is loaded
       // (and not on map loaded, because when the style is refreshed, it removes all the sources associated)
@@ -148,6 +162,11 @@ export class MapComponent implements OnInit, OnDestroy {
     this._mapService.switchLayer(baseLayer);
   }
 
+  switchSourceLayer(newLayerSource) {
+    this.currentLayerType = newLayerSource;
+    this._mapService.switchSourceLayer(newLayerSource);
+  }
+
   zoom() {
     return this.map.getZoom();
   }
@@ -190,7 +209,9 @@ export class MapComponent implements OnInit, OnDestroy {
     this.shareMessage = geosource.mapMessages.copied;
     setTimeout(() => {
       this.shareMessage = geosource.mapMessages.share;
-    },         2000);
+    },
+      // tslint:disable-next-line:align
+      2000);
   }
 
   mapUrl() {
diff --git a/src/app/map/components/minimap-control.ts b/src/app/map/components/minimap-control.ts
index 1b41fbfa..cacf6125 100644
--- a/src/app/map/components/minimap-control.ts
+++ b/src/app/map/components/minimap-control.ts
@@ -26,7 +26,7 @@ export class Minimap {
     width: '300px',
     height: '170px',
     style: '',
-    center: [0, 0],
+    center: [0, 0] as mapboxgl.LngLatLike,
     zoom: 6,
     bounds: 'parent',
     classes: '',
diff --git a/src/app/map/services/map.service.ts b/src/app/map/services/map.service.ts
index c23e7530..07b64c1a 100644
--- a/src/app/map/services/map.service.ts
+++ b/src/app/map/services/map.service.ts
@@ -3,6 +3,7 @@ import { Observable, Subject, BehaviorSubject, of, fromEvent, Subscription } fro
 import { Metadata, IMetadataLink } from '../../geosource/models';
 import { Notification } from '../../core/models';
 import * as mapboxgl from 'mapbox-gl';
+import * as palette from 'google-palette';
 import { map, catchError, debounceTime } from 'rxjs/operators';
 import { ElasticsearchService } from '../../geosource/services/elasticsearch.service';
 import { NotificationService } from '../../core/services';
@@ -24,6 +25,8 @@ export class MapService {
 
   metadata: Metadata;
   uriWFS: IMetadataLink;
+  uriWMS: IMetadataLink;
+  filterSearch: string;
 
   eventPopupAdded = false;
   minimap: Minimap;
@@ -66,10 +69,13 @@ export class MapService {
     private _datasetDetailService: DatasetDetailService,
   ) { }
 
-  createMap(url: string, baseLayer: any, addControls: boolean, options?: mapboxgl.MapboxOptions): mapboxgl.Map {
-    this.metadata = this._datasetDetailService.datasetMetadata;
-    console.log(this.metadata.total_documents);
+  createMap(metadata: Metadata, url: string, baseLayer: any, addControls: boolean,
+    // tslint:disable-next-line:align
+    options?: mapboxgl.MapboxOptions): mapboxgl.Map {
+    this.filterSearch = '';
+    this.metadata = metadata;
     this.uriWFS = this.metadata.link.find((e) => { return e.service === linkFormats.wfs; });
+    this.uriWMS = this.metadata.link.find((e) => { return e.service === linkFormats.wms; });
 
     // Reset to false in ordre to set event listener
     this.eventPopupAdded = false;
@@ -135,56 +141,43 @@ export class MapService {
   addLayers() {
     // Check if the metadata has WFS data format.
     this._currentLayerType = linkFormats.wfs;
-    this.addMVTLayers();
-    // this.getMVTFeatures(
-    //   this.metadata,
-    //   settings.maxDisplayFeatures).subscribe((geojson) => {
-    //     this.geojson = geojson;
-    //     this.addMVTLayers();
-    //   });
-    // this._map
-    //   .on('zoomend', () => {
-    //     this._mapToUpdate.next();
-    //   })
-    //   .on('moveend', () => {
-    //     this._mapToUpdate.next();
-    //   });
-    // if (this.uriWFS && this._datasetDetailService.datasetDataNumber < 100000) {
-    //   this._currentLayerType = linkFormats.wfs;
-    //   this.getMVTFeatures(
-    //     this.metadata,
-    //     settings.maxDisplayFeatures).subscribe((geojson) => {
-    //       this.geojson = geojson;
-    //       this.addMVTLayers();
-    //     });
-    //   this._map
-    //     .on('zoomend', () => {
-    //       this._mapToUpdate.next();
-    //     })
-    //     .on('moveend', () => {
-    //       this._mapToUpdate.next();
-    //     });
-
-    // } else {
-    //   this._currentLayerType = linkFormats.wms;
-    //   const uriWMS = this.metadata.link.find((e) => { return e.service === linkFormats.wms; });
-    //   this.addWMSLayer(uriWMS);
-    // }
+    const url = 'https://download.recette.data.grandlyon.com/mvt/grandlyon?LAYERS' +
+      `=${this.uriWFS.name}&map.imagetype=mvt&tilemode=gmap&tile={x}+{y}+{z}&mode=tile`;
+
+    if (this.uriWFS) {
+      this._map.addSource('vector-source', {
+        type: 'vector',
+        tiles: [url],
+      });
+
+      this.addMVTLayers();
+
+      // this._currentLayerType = linkFormats.wfs;
+      // this.getMVTFeatures(
+      //   this.metadata,
+      //   settings.maxDisplayFeatures).subscribe((geojson) => {
+      //     this.geojson = geojson;
+      //     this.addMVTLayers();
+      //   });
+      // this._map
+      //   .on('zoomend', () => {
+      //     this._mapToUpdate.next();
+      //   })
+      //   .on('moveend', () => {
+      //     this._mapToUpdate.next();
+      //   });
+
+    } else {
+      this._currentLayerType = linkFormats.wms;
+      this.addWMSLayer();
+    }
   }
 
   // - Fetch data from ES
   // - Add it to the map source
   // - Create the WFS layers from this source
   // - if the features are 'Point' type, create clustering layers
-  addMVTLayers() {
-    const url = 'https://download.recette.data.grandlyon.com/mvt/grandlyon?LAYERS' +
-      `=${this.uriWFS.name}&map.imagetype=mvt&tilemode=gmap&tile={x}+{y}+{z}&mode=tile`;
-
-    this._map.addSource('vector-source', {
-      type: 'vector',
-      tiles: [url],
-    });
-
+  addMVTLayers(colorExpression?: any) {
     // For 'Polygon' and 'MultiPolygon' features
     this._map.addLayer(
       {
@@ -224,7 +217,7 @@ export class MapService {
             this.featureHighlightedColor,
             this.featureColor,
           ],
-          'line-width':[
+          'line-width': [
             'interpolate', ['linear'], ['zoom'],
             12, 1,
             13, 2,
@@ -238,7 +231,8 @@ export class MapService {
 
     // Add layer + style for the points
     // Get paint options depending the dataset size
-    const paintOptions = this.getPointPaintOptions(this.metadata.total_documents);
+    const paintOptions =
+      this.getPointPaintOptions(this.metadata.total_documents, colorExpression) as mapboxgl.CirclePaint;
     this._map.addLayer(
       {
         id: 'point-features',
@@ -249,6 +243,9 @@ export class MapService {
         paint: paintOptions,
       });
 
+    console.log(this._map.getLayer('point-features'));
+
+
     if (!this.eventPopupAdded) {
       // Manage the cursor and feature state for point-features layer when mouse events
       this._map.on('mousemove', 'point-features', (e) => {
@@ -323,7 +320,7 @@ export class MapService {
     this.hoveredFeatureId = null;
   }
 
-  getPointPaintOptions(totalFeatures: number) {
+  getPointPaintOptions(totalFeatures: number, colorExpression?: any) {
     const paintOptions = {
       'circle-stroke-color': 'white',
       'circle-stroke-width': [
@@ -332,14 +329,18 @@ export class MapService {
         12, 0.3,
         16, 0.7,
       ],
-      'circle-color': ['case',
+    };
+    if (colorExpression) {
+      paintOptions['circle-color'] = colorExpression;
+    } else {
+      paintOptions['circle-color'] = ['case',
         ['boolean', ['feature-state', 'hover'], false],
         this.featureHoverColor,
         ['boolean', ['feature-state', 'highlight'], false],
         this.featureHighlightedColor,
         this.featureColor,
-      ],
-    };
+      ];
+    }
     if (totalFeatures < 1000) {
       paintOptions['circle-radius'] = [
         'interpolate', ['linear'], ['zoom'],
@@ -360,16 +361,71 @@ export class MapService {
   // Change the state of one feature.
   // State has the following format:{state: value}
   // Ex: {hover: true, highlight: false}
-  changeFeatureState(featureId: string, state) {
-    this._map.setFeatureState(
-      {
-        source: 'vector-source',
-        sourceLayer: this.uriWFS.name,
-        id: featureId,
-      },
-      state);
+  changeFeatureState(featureId: string | number, state) {
+    if (featureId) {
+      this._map.setFeatureState(
+        {
+          source: 'vector-source',
+          sourceLayer: this.uriWFS.name,
+          id: featureId,
+        },
+        state);
+    }
   }
 
+  updateAggregationFilter(aggregations: string[]) {
+    const options = [];
+    options.push('match');
+    options.push(['get', 'genre']);
+
+    const seq = palette('tol-sq', aggregations.length);
+
+    aggregations.forEach((agg, index) => {
+      options.push(agg);
+      options.push(`#${seq[index]}`);
+    });
+    options.push('#ccc'); // Others
+    this._map.setPaintProperty('point-features', 'circle-color', options);
+    // this._map.removeLayer('point-features');
+    // this.addMVTLayers(options);
+  }
+
+  // updateFilter(filterSearch: string) {
+  //   console.log(filterSearch);
+  //   this.filterSearch = filterSearch;
+
+  //   if (this.filterSearch === '') {
+  //     console.log('remove');
+  //     this._map.setFilter('point-features', null);
+  //   } else {
+  //     const features = this._map.querySourceFeatures('vector-source', {
+  //       sourceLayer: this.uriWFS.name,
+  //     });
+
+  //     const feature = features[0];
+  //     const filters = [];
+  //     filters.push('any');
+  //     for (const property in feature.properties) {
+
+  //       if (typeof feature.properties[property] === 'string') {
+  //         filters.push(['match', ['get', property], this.filterSearch, true, false]);
+  //       }
+  //     }
+  //     this._map.setFilter('point-features', filters);
+  //   }
+
+  // }
+
+  // updateFeatures(searchValue) {
+  //   this.getWFSFeatures(
+  //     this.metadata,
+  //     settings.maxDisplayFeatures).subscribe((geojson) => {
+  //       this.geojson = geojson;
+  //       this.addWFSLayer();
+  //     });
+
+  // }
+
   addClickEventOnLayer(layer: string) {
     this._map.on('click', layer, (e) => {
       this.selectedFeature = e.features[0].id;
@@ -404,13 +460,13 @@ export class MapService {
   }
 
   // Add the raster (WMS) layer
-  addWMSLayer(uriWMS: IMetadataLink) {
+  addWMSLayer() {
     // ------------------- WMS Source & Layer -------------------
-    this._map.addSource(linkFormats.wms, {
+    this._map.addSource('wms-source', {
       type: 'raster',
       tiles: [
-        `${uriWMS.url}?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&` +
-        `srs=EPSG:3857&width=256&height=256&transparent=true&layers=${uriWMS.name}`,
+        `${this.uriWMS.url}?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&` +
+        `srs=EPSG:3857&width=256&height=256&transparent=true&layers=${this.uriWMS.name}`,
       ],
       tileSize: 256,
     });
@@ -418,7 +474,7 @@ export class MapService {
     this._map.addLayer({
       id: 'wms-layer',
       type: 'raster',
-      source: 'WMS',
+      source: 'wms-source',
       paint: {},
     });
 
@@ -521,6 +577,22 @@ export class MapService {
     return this._elasticSearchService.getDataFromCoordinates(filter, this.metadata.geonet.uuid);
   }
 
+  switchSourceLayer(layerSource) {
+    this._currentLayerType = layerSource;
+    console.log(this._map.getStyle().layers);
+    if (layerSource === linkFormats.wms) {
+      this._map.getLayer('point-features') ? this._map.removeLayer('point-features') : '';
+      this._map.getLayer('line-features') ? this._map.removeLayer('line-features') : '';
+      this._map.getLayer('polygon-features') ? this._map.removeLayer('polygon-features') : '';
+      this._map.removeSource('vector-source');
+      this.addWMSLayer();
+    } else if (layerSource === linkFormats.wfs) {
+      this._map.removeLayer('wms-layer');
+      this._map.removeSource('wms-source');
+      this.addMVTLayers();
+    }
+  }
+
   switchLayer(baseLayer) {
     // Set selected base layer
     this.selectedBaseLayer = baseLayer;
diff --git a/src/app/map/settings.ts b/src/app/map/settings.ts
index ca5bacf5..3323d1a7 100644
--- a/src/app/map/settings.ts
+++ b/src/app/map/settings.ts
@@ -1,5 +1,5 @@
 export const settings = {
-  maxDisplayFeatures: 500,
+  maxDisplayFeatures: 100000,
 
   // Map
   defaultBaseLayer: 0,
-- 
GitLab