Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mmcloughlin/globe
Globe wireframe visualizations in Golang
https://github.com/mmcloughlin/globe
Last synced: 6 days ago
JSON representation
Globe wireframe visualizations in Golang
- Host: GitHub
- URL: https://github.com/mmcloughlin/globe
- Owner: mmcloughlin
- License: isc
- Created: 2017-07-03T00:24:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-09T19:29:54.000Z (10 months ago)
- Last Synced: 2024-12-04T18:33:49.225Z (9 days ago)
- Language: Go
- Homepage: https://pkg.go.dev/github.com/mmcloughlin/globe
- Size: 199 KB
- Stars: 1,592
- Watchers: 24
- Forks: 51
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- Awesome - Globe - Globe wireframe visualizations in Golang (Multimedia / Image and pictures)
- my-awesome-github-stars - mmcloughlin/globe - Globe wireframe visualizations in Golang (Go)
- go-awesome - globe - Globe wireframe drawing (Open source library / Charts)
README
# globe
Globe wireframe visualizations in Golang backed by
[pinhole](https://github.com/tidwall/pinhole).[![go.dev Reference](https://img.shields.io/badge/doc-reference-007d9b?logo=go&style=flat-square)](https://pkg.go.dev/github.com/mmcloughlin/globe)
![Build status](https://img.shields.io/github/actions/workflow/status/mmcloughlin/globe/ci.yml?style=flat-square)## Getting Started
Install `globe` with
```sh
$ go get -u github.com/mmcloughlin/globe
```Start with a blank globe with a graticule at 10 degree intervals.
```go
g := globe.New()
g.DrawGraticule(10.0)
g.SavePNG("graticule.png", 400)
```Add some land boundaries and center it on a point. Alternatively
[`DrawCountryBoundaries`](https://godoc.org/github.com/mmcloughlin/globe#Globe.DrawCountryBoundaries)
will give you countries.```go
g := globe.New()
g.DrawGraticule(10.0)
g.DrawLandBoundaries()
g.CenterOn(51.453349, -2.588323)
g.SavePNG("land.png", 400)
```Here's all the [Starbucks
locations](https://github.com/mmcloughlin/starbucks). Note `color.NRGBA`
recommended to [avoid
artifacts](https://github.com/mmcloughlin/globe/issues/6).```go
shops, err := LoadCoffeeShops("./starbucks.json")
if err != nil {
log.Fatal(err)
}green := color.NRGBA{0x00, 0x64, 0x3c, 192}
g := globe.New()
g.DrawGraticule(10.0)
for _, s := range shops {
g.DrawDot(s.Lat, s.Lng, 0.05, globe.Color(green))
}
g.CenterOn(40.645423, -73.903879)
err = g.SavePNG("starbucks.png", 400)
if err != nil {
log.Fatal(err)
}
```You can also do lines along great circles.
```go
g := globe.New()
g.DrawGraticule(10.0)
g.DrawLandBoundaries()
g.DrawLine(
51.453349, -2.588323,
40.645423, -73.903879,
globe.Color(color.NRGBA{255, 0, 0, 255}),
)
g.CenterOn(50.244440, -37.207949)
g.SavePNG("line.png", 400)
```Also rectangles.
```go
g := globe.New()
g.DrawGraticule(10.0)
g.DrawLandBoundaries()
g.DrawRect(
41.897209, 12.500285,
55.782693, 37.615993,
globe.Color(color.NRGBA{255, 0, 0, 255}),
)
g.CenterOn(48, 25)
g.SavePNG("rect.png", 400)
```See [examples](examples/) and [package
documentation](https://pkg.go.dev/github.com/mmcloughlin/globe) for more.## License
`globe` is available under the ISC [License](/LICENSE).