1
1
Fork
You've already forked mercator
0
OpenStreetMap but as terminal user interface (TUI) program https://xn--gckvb8fzb.com
  • Go 100%
Find a file
2025年12月15日 15:04:48 +01:00
.github Add pull_request_template.md 2025年12月15日 15:04:48 +01:00
mapview Implemented map styles 2023年01月15日 13:15:40 -05:00
.editorconfig Added boilerplate 2023年01月15日 00:20:25 -05:00
.gitignore Added boilerplate 2023年01月15日 00:20:25 -05:00
.goreleaser.yaml Added boilerplate 2023年01月15日 00:20:25 -05:00
go.mod Updated dependencies 2024年03月30日 13:24:50 -05:00
go.sum Updated dependencies 2024年03月30日 13:24:50 -05:00
LICENSE Added LICENSE, README.md, screenshot 2023年01月15日 00:26:42 -05:00
mercator.gif Updated GIF 2023年01月15日 13:37:09 -05:00
mercator.go Added style flag, fixed args issue 2023年01月15日 13:25:11 -05:00
mercator.tape Updated GIF 2023年01月15日 13:37:09 -05:00
README.md Extended documentation 2023年01月15日 13:30:53 -05:00

Mercator

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 north
  • arrow right/l: Move east
  • arrow down/j: Move south
  • arrow 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()}