Documentation ¶
Overview ¶
Package sunlightlib merges two image files of a sphere in mercator projection as if that sphere revolves around the sun, producing an approximate day- and night-visualization.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns the sunlightlib struct with default values. The height is always half of the width. visualization has currently only 'static' implemented ('animated' to follow)
func NewStatic ¶
NewStatic is a convenience method to return a single static sunlightlib
TODO(cpr): implement animated version (e.g. gif)
Example ¶
slms := NewStatic(360, time.Now().Local()) fmt.Println(slms.visualization)
Output: static
func ReturnStaticPngBase64 ¶
ReturnStaticPngBase64 is called with a sunlightlib struct and returns a base64 encoded string of a single sunlightlib in png format.
Example ¶
handler := func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") slm := NewStatic(720, time.Now().Local()) encoded, _ := ReturnStaticPngBase64(&slm) html := "<html><body><img src='data:image/png;base64," + encoded + "' /><p>" fmt.Fprint(w, html) } w := httptest.NewRecorder() req := httptest.NewRequest("GET", "http://example.com", nil) handler(w, req) resp := w.Result() fmt.Println(resp.StatusCode)
Output: 200
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.