diff --git a/src/kibana/components/config/defaults.js b/src/kibana/components/config/defaults.js index 6d5c75f5c5fad..35c66d76dc27d 100644 --- a/src/kibana/components/config/defaults.js +++ b/src/kibana/components/config/defaults.js @@ -43,6 +43,21 @@ define(function (require) { value: 6, description: 'The maximum geoHash size allowed in a tile map', }, + 'visualization:tileMap:wms': { + value: false, + description: 'Set for WMS mapping provider' + }, + 'visualization:tileMap:url': { + value: 'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', + description: 'URL of mapping provider' + }, + 'visualization:tileMap:options': { + value: '{ "attribution": "Tiles by MapQuest — ' + + 'Map data © OpenStreetMap contributors, ' + + 'CC-BY-SA", "subdomains": "1234" }', + description: 'TileLayer options, see leafletjs documentation', + type: 'json' + }, 'csv:separator': { value: ',', description: 'Separate exported values with this string', @@ -64,4 +79,4 @@ define(function (require) { description: 'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation.' } }; -}); \ No newline at end of file +}); diff --git a/src/kibana/components/vislib/visualizations/tile_map.js b/src/kibana/components/vislib/visualizations/tile_map.js index db1f0aef0bf65..8bcef5c22fe52 100644 --- a/src/kibana/components/vislib/visualizations/tile_map.js +++ b/src/kibana/components/vislib/visualizations/tile_map.js @@ -1,5 +1,5 @@ define(function (require) { - return function TileMapFactory(d3, Private) { + return function TileMapFactory(d3, Private, config) { var _ = require('lodash'); var $ = require('jquery'); var L = require('leaflet'); @@ -71,12 +71,12 @@ define(function (require) { } var featureLayer; - var tileLayer = L.tileLayer('http://otile{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; + if (config.get('visualization:tileMap:wms')) { + tileLayer = L.tileLayer.wms(config.get('visualization:tileMap:url'), config.get('visualization:tileMap:options')); + } else { + tileLayer = L.tileLayer(config.get('visualization:tileMap:url'), config.get('visualization:tileMap:options')); + } var mapOptions = { minZoom: 2,