LoginSignup
2
0

More than 5 years have passed since last update.

CLIでMapを確認する方法

Posted at

CLIでlocation情報であるlat, locを指定してMap上で表示するツールを探していたのですが、なかなか見つからなかったので、なにか良いものがあったら教えてください。

一応、見つかったものを紹介します。できれば、(1)lat,locでqueryできること、(2)google mapで拡大、縮小できることが条件なんですけど、一方しか見つかりませんでした。

blessed-contrib:map

# とりあえずサーバー情報を引き出してみる
$ whois example.com
$ nslookup exmaple.com
8.8.8.8
# 仮にipが8.8.8.8だったとする, サーバーのおおよその位置をblessed-contribを使って世界地図上で表示してみる
# https://github.com/yaronn/blessed-contrib
$ git clone https://github.com/yaronn/blessed-contrib.git
$ cd blessed-contrib
$ vim examples/map-query-location.js
blessed-contrib/examples/map-query-location.js
var blessed = require('blessed')
  , contrib = require('../')
  , screen = blessed.screen()
  , map = contrib.map({label: 'World Map'})
  , loc = process.argv[2]
  , rLoc = loc.split(",")

screen.append(map)
map.addMarker({"lat" : rLoc[0], "lon" : rLoc[1], color: "red", char: "X" })

screen.render()

nodeのblessed-contribに触発され、golangやrustで書かれたものもあるみたいです。これらを使ってcli toolを書くと便利そう。

mapscii

# https://github.com/rastapasta/mapscii
$ sudo npm install -g mapscii
$ mapscii

...こちらはqueryできない

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0