---
title: "kibana4.5修改为高德地图"
author: "2002wmj"
date: "2016-07-13T16:51:27Z"
tags: []
categories: ["移动开发"]
slug: "kibana4-5"
draft: false
lastmod: "2016-07-13T16:51:27Z"
id: 2311042
url: "https://2002wmj.iteye.com/blog/2311042"
---

编辑kibana-4.3.1-linux-x64/src/ui/public/vislib/visualizations/\_map.js

添加highlight行，注释原来的内容  
url: 'http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh\_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',

![kibana4.5modify_chinamap](https://www.joewen.top/wp-content/uploads/2016/07/Image.png)

 

 

还需要修改kibana-4.3.1-linux-x64/src/ui/autoload.js

 

在highlight行最后添加’ui/vislib’

![kibana4.5modify_chinamap2](https://www.joewen.top/wp-content/uploads/2016/07/Image-1.png)

 

重启生效

* * *

更改后发现打开map中吹出现空白，如下图

![kibana_map_error](https://www.joewen.top/wp-content/uploads/2016/07/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2016-07-09-%E4%B8%8B%E5%8D%884.28.54.png)

需要点放大+号，才会出现地图。

查看elasticsearch.cn高手们发现如下内容：

白板是地图的默认值mapZoom=2

if (self.\_attr.lastZoom) {  
mapZoom = self.\_attr.lastZoom;  
}  
修改为  
if (self.\_attr.lastZoom) {  
mapZoom = self.\_attr.lastZoom;  
} else {  
mapZoom = 5;  
}

修改默认显示中国  
if (self.\_attr.lastCenter) {  
mapCenter = self.\_attr.lastCenter;  
}  
修改为  
if (self.\_attr.lastCenter) {  
mapCenter = self.\_attr.lastCenter;  
} else {  
mapCenter = {lat: 32.97180377635759, lng: 108.28125};  
}

修改以下文件：kibana-4.5.0-linux-x64/src/ui/public/vislib/visualizations/\_map.js

defaultMapZoom = 2 改为5