Globe wireframe visualizations in Golang

Overview

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.

Comments
  • Overlapping points causes a turquoise noise/artefact

    Overlapping points causes a turquoise noise/artefact

    Firstly thanks for the great library! Top work.

    I noticed that using GeoJSON files with overlapping points sometimes produces these strange turquoise noise effects. Any way to combat/fix that behaviour?

    eb41b547-aa7e-4402-a47e-1baf9b10e6c5

    opened by JamesLMilner 5
  • TestGraticuleCenterOn fails on arm64

    TestGraticuleCenterOn fails on arm64

    On Apple M1:

    > GOARCH=arm64 go test -v
    === RUN   TestGraticule
    --- PASS: TestGraticule (0.10s)
    === RUN   TestGraticuleCenterOn
        globe_test.go:50:
            	Error Trace:	globe_test.go:50
            	            				globe_test.go:63
            	Error:      	Not equal:
            	            	expected: "04c8271e8d48ea580a6d340d9be7a261"
            	            	actual  : "80e7f15997d3597d8cc451876e0bc7ae"
    
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-04c8271e8d48ea580a6d340d9be7a261
            	            	+80e7f15997d3597d8cc451876e0bc7ae
            	Test:       	TestGraticuleCenterOn
    --- FAIL: TestGraticuleCenterOn (0.09s)
    === RUN   TestDrawDots
    --- PASS: TestDrawDots (0.03s)
    === RUN   TestDrawLand
    --- PASS: TestDrawLand (0.06s)
    === RUN   TestDrawCountries
    --- PASS: TestDrawCountries (0.08s)
    === RUN   TestLine
    --- PASS: TestLine (0.02s)
    === RUN   TestRect
    --- PASS: TestRect (0.02s)
    === RUN   TestCartestian
    --- PASS: TestCartestian (0.00s)
    === RUN   TestHaversine
    --- PASS: TestHaversine (0.00s)
    === RUN   TestIntermediate
    --- PASS: TestIntermediate (0.00s)
    === RUN   TestDestination
    --- PASS: TestDestination (0.00s)
    FAIL
    exit status 1
    FAIL	github.com/mmcloughlin/globe	0.597s
    

    The test still passes under amd64. Unclear to me right now why the output should be different. On visual inspection, the images look right on both architectures, but there are tiny pixel value differences.

    opened by mmcloughlin 0
  • Add NewStyled method for creating a globe with a custom style

    Add NewStyled method for creating a globe with a custom style

    Introduces a new constructor function "NewStyled", which takes as a parameter a style and constructs an empty globe with that style.

    This gives control over controls in the style object which aren't accessible by default or by using Options, and without changing the DefaultStyle, which is globally scoped and may have unintended side effects if changed.

    opened by taywrobel 2
  • CenterOn has confusing behavior when called more than once

    CenterOn has confusing behavior when called more than once

    As noticed in #3 the CenterOn method does the wrong thing when called multiple times. This is because the rotation is applied assuming the default initial state of the globe.

    It should be an easy fix to remember the current position the globe has been rotated to and apply a rotation relative to that.

    bug 
    opened by mmcloughlin 1
  • Globe animations/GIFs?

    Globe animations/GIFs?

    It would be cool to be able save a rotating globe as a GIF (or similar format). This could possibly be done through sewing generated images together (using something like ffmpeg).

    enhancement 
    opened by LOZORD 7
  • culling the

    culling the "wires" in the background

    First.. this is cool and amazingly easy. I could really see me using this in some of the visualizations I do for scientific drilling data from NSF.

    Second.. I am not a graphics person.. so forgive the poorly worded question..

    The visuals are ncie, but might get a bit confusing given the wireframe aspect of these where one can see through to the continent coastlines on the other side of the globe.

    Is there there any chance in the code base to enable a situation where the globe surface is opaque?

    regardless.. thanks.. would love to see more of these types of packages in Go for geospatial data

    enhancement 
    opened by fils 2
go chart is a basic charting library in native golang.

Package chart is a very simple golang native charting library that supports timeseries and continuous line charts.

Will Charczuk 3.6k Nov 27, 2022
🎨 The adorable charts library for Golang

go-echarts ?? The adorable charts library for Golang. If a language can be used to build web scrapers, it definitely needs to provide a graceful data

go-echarts 5k Nov 28, 2022
go-echarts 🎨 The adorable charts library for Golang

go-echarts ?? The adorable charts library for Golang. If a language can be used to build web scrapers, it definitely needs to provide a graceful data

go-echarts 5k Nov 22, 2022
🚀Statsview is a real-time Golang runtime stats visualization profiler

Statsview is a real-time Golang runtime stats visualization profiler. It is built top on another open-source project, go-echarts, which helps statsview to show its graphs on the browser.

go-echarts 502 Nov 26, 2022
Ltree Visualizer - A golang library to visualize postgres ltree type data using DOT language and Graphviz

Ltree Visualizer A golang library to visualize postgres ltree type data using DOT language and Graphviz What is Ltree? Ltree is a data type which is u

Vasubabu Jinagam 8 Jun 12, 2022
A golang implementation of endlessh exporting Prometheus metrics, visualized by a Grafana dashboard.

endlessh-go A golang implementation of endlessh exporting Prometheus metrics, visualized by a Grafana dashboard. Introduction Endlessh is a great idea

Shizun Ge 65 Oct 29, 2022
Interactive dependency graph visualization tool for golang

Interactive dependency graph visualization tool for golang using the awesome cytoscape graph visualizer.

Armin Becher 6 Sep 1, 2022
A charts library for Golang

go-charts go-charts基于go-chart生成数据图表,无其它模块的依赖纯golang的实现,支持svg与png的输出,Apache ECharts在前端开发中得到众多开发者的认可,go-charts兼容Apache ECharts的配置参数,简单快捷的生成相似的图表(svg或png

Tree Xie 95 Nov 24, 2022
Gfx - Golang file system extension library

gfx Golang文件操作扩展库,包含工作和生活中关于文件操作的各种有用的使用方法,包括 更友好的API 文件创建 文件删除 文件复制 一切皆可配置 文件名

张川 0 Mar 10, 2022
Btc-globe - Visualize Bitcoin node locations using golang

btc-globe Visualize Bitcoin nodes by location using Golang

null 0 Jan 19, 2022
3D Wireframe Drawing Library for Go

pinhole 3D Wireframe Drawing Library for Go Javascript Version Demo Why does this exist? I needed a CPU based 3D rendering library with a very simple

Josh Baker 544 Nov 29, 2022
estruct traverses javascript projects and maps all the dependencies and relationships to a JSON. the output can be used to build network visualizations of the project and document the architecture.

EStruct traverses javascript projects and maps all the dependencies and relationships to a JSON. The output can be used to build network visualizations of the project and document the architecture.

Ray Luxembourg 11 Jan 27, 2022
[Crawler/Scraper for Golang]🕷A lightweight distributed friendly Golang crawler framework.一个轻量的分布式友好的 Golang 爬虫框架。

Goribot 一个分布式友好的轻量的 Golang 爬虫框架。 完整文档 | Document !! Warning !! Goribot 已经被迁移到 Gospider|github.com/zhshch2002/gospider。修复了一些调度问题并分离了网络请求部分到另一个仓库。此仓库会继续

null 210 Oct 29, 2022
Realize is the #1 Golang Task Runner which enhance your workflow by automating the most common tasks and using the best performing Golang live reloading.

#1 Golang live reload and task runner Content - ⭐️ Top Features - ???? Get started - ?? Config sample - ?? Commands List - ?? Support and Suggestions

Oxequa 4.3k Nov 26, 2022
golang feature toggle library - a library to help make golang feature toggling clean and easy

toggle supports env_variable backed toggling. It can also be updated via a pubsub interface (tested w/ redis) 2 engines for toggle backing are include

John Calabrese 24 Mar 29, 2022
Hprose 1.0 for Golang (Deprecated). Hprose 2.0 for Golang is here:

Hprose for Golang Introduction Installation Usage Http Server Http Client Synchronous Invoking Synchronous Exception Handling Asynchronous Invoking As

Hprose 137 Sep 22, 2022
graylog-golang is a full implementation for sending messages in GELF (Graylog Extended Log Format) from Go (Golang) to Graylog

graylog-golang is a full implementation for sending messages in GELF (Graylog Extended Log Format) from Go (Golang) to Graylog

Robert Kowalski 79 Aug 12, 2022
Realize is the #1 Golang Task Runner which enhance your workflow by automating the most common tasks and using the best performing Golang live reloading.

#1 Golang live reload and task runner Content - ⭐️ Top Features - ???? Get started - ?? Config sample - ?? Commands List - ?? Support and Suggestions

Oxequa 4.3k Nov 29, 2022
Golang Skeleton With Fully Managed Versions For Kick Start GoLang Project Development

Golang Skeleton With Fully Managed Versions For Kick Start GoLang Project Development There is no doubt that Golang’s good documentation and intellige

MindInventory 356 Nov 23, 2022
Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package.

Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package. The library allows you to call Go service methods from PHP with a minimal footprint, structures and []byte support.

Spiral Scout 1.1k Nov 23, 2022