worldmap mysql,worldmap插件使用

概述

今天尝试使用了一把worldmap插件,昨天下午开始弄的,安装还是挺容易的,实际制作pannel时,卡住了,今天早晨才搞定,挺开心,哈哈。

插件安装

1.

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

worldmap1.PNG

2.

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

image.png

3.

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

image.png

4.cmd 进入grafana安装目录/bin:执行步骤3中的命令

5.安装完成后,重启grafana-server

6.此时进去,你就能惊喜的发现,有worldmap可选了

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

image.png

使用方法

我使用的数据库是MySQL,这里数据查询有两种方式:geohash(坐标是一个字符串,这个我之前是不懂的,备注下)和coordinates(坐标是经度+纬度)

geohash方式

1.底层数据表

构造字段:time(时间,暂时没啥用),geohash(字符串模式坐标),host(地点名称),value(值,貌似是用来画圈圈的),我一般会把命名给固定下来。

示例查询语句:

select now() as time

,'wttf5jy' as geohash

,'cmbsu' as host

,rand()*2 as value

from tb_location

2.图表配置

Field Mapping/Table Query Format选"geohash",其他应该不用变,因为字段名已设定一致

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

image.png

initial Zoom设置为5,不然地图太大了,搞小一点

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

image.png

最后呈现,像这样

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

image.png

coordinates方式

1.底层数据表

构造字段:time(时间,暂时没啥用),longitude(经度),latitude(纬度),host(地点名称),value(值),我还是一般会把命名给固定下来。

示例查询语句:

select now() as time

,address as host

,longitude

,latitude

,rand()*2 as value

from tb_location

2、图表配置

直接上图

50603a03b02f?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

image.png

其他的参考geohash方式,差不多的

结束语

复杂的地图应用,往往都是从简单的开始的,下来就是发挥worldmap的魅力时刻!还有3D地图等我去探索,哈哈哈哈哈哈哈哈哈

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值