globe

Globe wireframe visualizations in Golang

  • 所有者: mmcloughlin/globe
  • 平台:
  • 许可证: ISC License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

globe

Globe wireframe visualizations in Golang backed by
pinhole.

go.dev Reference
Build status

Getting Started

Install globe with

$ go get -u github.com/mmcloughlin/globe

Start with a blank globe with a graticule at 10 degree intervals.

g := globe.New()
g.DrawGraticule(10.0)
g.SavePNG("graticule.png", 400)

Add some land boundaries and center it on a point. Alternatively
DrawCountryBoundaries
will give you countries.

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
. Note color.NRGBA
recommended to avoid
artifacts
.

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.

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.

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 and
godoc for more.

License

globe is available under the ISC License.

主要指标

概览
名称与所有者mmcloughlin/globe
主编程语言Go
编程语言Go (语言数: 2)
平台
许可证ISC License
所有者活动
创建于2017-07-03 00:24:48
推送于2024-02-09 19:29:54
最后一次提交2024-02-09 11:29:53
发布数0
用户参与
星数1.6k
关注者数24
派生数50
提交数54
已启用问题?
问题数7
打开的问题数5
拉请求数7
打开的拉请求数1
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?