Skip to content

Commit

Permalink
Enable tile maps to be configured
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjones2 committed Jan 11, 2015
1 parent 6fba075 commit 9931e25
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
17 changes: 16 additions & 1 deletion src/kibana/components/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=\\"http://www.mapquest.com/\\">MapQuest</a> &mdash; ' +
'Map data &copy; <a href=\\"http://openstreetmap.org\\">OpenStreetMap</a> contributors, ' +
'<a href=\\"http://creativecommons.org/licenses/by-sa/2.0/\\">CC-BY-SA</a>", "subdomains": "1234" }',
description: 'TileLayer options, see leafletjs documentation',
type: 'json'
},
'csv:separator': {
value: ',',
description: 'Separate exported values with this string',
Expand All @@ -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.'
}
};
});
});
14 changes: 7 additions & 7 deletions src/kibana/components/vislib/visualizations/tile_map.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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 <a href="http://www.mapquest.com/">MapQuest</a> &mdash; ' +
'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
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,
Expand Down

0 comments on commit 9931e25

Please sign in to comment.