GithubHelp home page GithubHelp logo

mrusme / mercator Goto Github PK

View Code? Open in Web Editor NEW
71.0 3.0 1.0 11.3 MB

OpenStreetMap but as terminal user interface (TUI) program

Home Page: https://xn--gckvb8fzb.com

License: GNU General Public License v3.0

Go 100.00%
bubble bubbletea cli command-line command-line-tool map maps openstreetmap osm terminal

mercator's Introduction

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:

package main

import (
  tea "github.com/charmbracelet/bubbletea"
  "github.com/mrusme/mercator/mapview"
)

type model struct {
  mv mapview.Model
}

func main() {
  m := NewModel()
  m.mv.SetLocation("jamaica", 15)

  p := tea.NewProgram(m, tea.WithAltScreen())
  if _, err := p.Run(); err != nil {
    panic(err)
  }
}

func NewModel() model {
  m := model{}
  m.mv = mapview.New(80, 24)
  return m
}

func (m model) Init() tea.Cmd {
  return tea.Batch(tea.EnterAltScreen)
}

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
  switch mt := msg.(type) {
  case tea.KeyMsg:
    switch mt.String() {
    case "q", "esc", "ctrl+c":
      return m, tea.Quit
    }

  case tea.WindowSizeMsg:
    m.mv.Width = mt.Width
    m.mv.Height = mt.Height
    return m, nil

  }

  var cmd tea.Cmd
  m.mv, cmd = m.mv.Update(msg)
  return m, cmd
}

func (m model) View() string {
  return m.mv.View()
}

mercator's People

Contributors

dependabot[bot] avatar mrusme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rohankumardubey

mercator's Issues

sixel for image rendering

Hi there :)

I like the project and would love to be able to replace my GUI map application with a TUI one

Would it be possible to implement a sixel renderer (eg go-sixel) to render the map instead of ansimage?
Bc then we could have way more details and the map would actually be readable :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.