OpenStreetMap but as terminal user interface (TUI) program
https://xn--gckvb8fzb.com
bubble
bubbletea
cli
command-line
command-line-tool
map
maps
openstreetmap
osm
terminal
terminal-app
terminal-based
tui
- Go 100%
| .github | Add pull_request_template.md | |
| mapview | Implemented map styles | |
| .editorconfig | Added boilerplate | |
| .gitignore | Added boilerplate | |
| .goreleaser.yaml | Added boilerplate | |
| go.mod | Updated dependencies | |
| go.sum | Updated dependencies | |
| LICENSE | Added LICENSE, README.md, screenshot | |
| mercator.gif | Updated GIF | |
| mercator.go | Added style flag, fixed args issue | |
| mercator.tape | Updated GIF | |
| README.md | Extended documentation | |
Mercator
OpenStreetMap but as terminal user interface (TUI) program and Bubble Tea Bubble.
Build
$ go get
$ go build .
The binary is called mercator
Usage
mercator accepts latitude and longitude as arguments, e.g.:
$ mercator 25.0782266 -77.3383438
It also accepts a location name or address, e.g.:
$ mercator miami
Style
mercator accepts the -style flag with an integer value representing one of
the options listed as
Style,
e.g.:
$ mercator -style 4 new york
Navigation
arrow up/k: Move northarrow right/l: Move eastarrow down/j: Move southarrow left/h: Move west-/_: Zoom out+/=: Zoom in
Bubble
You can embed the mapview into your Bubble Tea application:
packagemainimport(tea"github.com/charmbracelet/bubbletea""github.com/mrusme/mercator/mapview")typemodelstruct{mvmapview.Model}funcmain(){m:=NewModel()m.mv.SetLocation("jamaica",15)p:=tea.NewProgram(m,tea.WithAltScreen())if_,err:=p.Run();err!=nil{panic(err)}}funcNewModel()model{m:=model{}m.mv=mapview.New(80,24)returnm}func(mmodel)Init()tea.Cmd{returntea.Batch(tea.EnterAltScreen)}func(mmodel)Update(msgtea.Msg)(tea.Model,tea.Cmd){switchmt:=msg.(type){casetea.KeyMsg:switchmt.String(){case"q","esc","ctrl+c":returnm,tea.Quit}casetea.WindowSizeMsg:m.mv.Width=mt.Widthm.mv.Height=mt.Heightreturnm,nil}varcmdtea.Cmdm.mv,cmd=m.mv.Update(msg)returnm,cmd}func(mmodel)View()string{returnm.mv.View()}