diff --git a/src/kibana/components/vislib/visualizations/tile_map.js b/src/kibana/components/vislib/visualizations/tile_map.js index d57642f0c2248..904871b3da841 100644 --- a/src/kibana/components/vislib/visualizations/tile_map.js +++ b/src/kibana/components/vislib/visualizations/tile_map.js @@ -1,8 +1,13 @@ define(function (require) { - return function TileMapFactory(d3, Private, config) { + return function TileMapFactory(d3, Private, configFile) { var _ = require('lodash'); var $ = require('jquery'); var L = require('leaflet'); + var marked = require('marked'); + marked.setOptions({ + gfm: true, + sanitize: true + }); require('leaflet-heat'); require('leaflet-draw'); require('css!components/vislib/styles/main'); @@ -75,11 +80,11 @@ define(function (require) { self.addLatLng(self.geoJson); var div = $(this).addClass('tilemap'); - var tileLayer = L.tileLayer('https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', { - attribution: 'Tiles by MapQuest — ' + - 'Map data © OpenStreetMap contributors, ' + - 'CC-BY-SA', - subdomains: '1234' + var tileLayer = L.tileLayer(configFile.tilemap_url, { + attribution: marked(configFile.tilemap_attribution), + subdomains: configFile.tilemap_subdomains, + minZoom: configFile.tilemap_min_zoom, + maxZoom: configFile.tilemap_max_zoom }); var drawOptions = {draw: {}}; @@ -97,8 +102,6 @@ define(function (require) { }); var mapOptions = { - minZoom: 1, - maxZoom: 18, layers: tileLayer, center: self._attr.mapCenter, zoom: self._attr.mapZoom, diff --git a/src/kibana/plugins/visualize/styles/main.less b/src/kibana/plugins/visualize/styles/main.less index 8b1b95d1662ba..a9974695abe07 100644 --- a/src/kibana/plugins/visualize/styles/main.less +++ b/src/kibana/plugins/visualize/styles/main.less @@ -54,4 +54,8 @@ } +.leaflet-control-attribution p { + display: inline; +} + @import "../editor/styles/editor.less"; diff --git a/src/server/config/kibana.yml b/src/server/config/kibana.yml index a0af6ea6d80eb..282a928f61650 100644 --- a/src/server/config/kibana.yml +++ b/src/server/config/kibana.yml @@ -66,3 +66,18 @@ verify_ssl: true # A value to use as a XSRF token. This token is sent back to the server on each request # and required if you want to execute requests from other clients (like curl). # xsrf_token: "" + +# The url used for loading tilemaps +tilemap_url: "https://tiles.elastic.co/v1/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana" + +# Minimum map zoom level +tilemap_min_zoom: 0 + +# Maximum map zoom level +tilemap_max_zoom: 8 + +# Displays attribution data in the bottom right corner of the map +tilemap_attribution: "© [Elastic Tile Service](https://www.elastic.co/elastic_tile_service_tos)" + +# A list of subdomains, denoted by {s} in tilemap_url +tilemap_subdomains: [] diff --git a/src/server/routes/index.js b/src/server/routes/index.js index d7c781697394f..3c98410a18353 100644 --- a/src/server/routes/index.js +++ b/src/server/routes/index.js @@ -8,7 +8,12 @@ router.get('/config', function (req, res, next) { 'kibana_index', 'default_app_id', 'shard_timeout', - 'xsrf_token' + 'xsrf_token', + 'tilemap_url', + 'tilemap_min_zoom', + 'tilemap_max_zoom', + 'tilemap_attribution', + 'tilemap_subdomains' ]; var data = _.pick(config.kibana, keys); data.plugins = config.plugins;