googlemaps

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package googlemaps shows Google Maps inside your screen.

nimbus native plugin add google-maps -key YOUR_API_KEY

googlemaps.Map{
	Center: googlemaps.LatLng{Latitude: 18.53, Longitude: 73.89}, Zoom: 14,
	Markers: []googlemaps.Marker{{ID: "cafe", At: cafe, Title: "Monsoon Coffee"}},
	OnMarker: open,
	Style: ui.Style{Grow: 1},
}

The key goes in the app, where anyone can read it: in Google Cloud, limit it to your app and to the Maps SDKs. There are no maps on the web yet.

Index

Constants

This section is empty.

Variables

View Source
var WebKey = os.Getenv("GOOGLE_MAPS_WEB_KEY")

LatLng is a place. WebKey is the Maps JavaScript API key the web uses, from GOOGLE_MAPS_WEB_KEY unless you set it. It's visible in the page, so restrict it to your site's address in Google Cloud. Without one, the map on the web is an empty box.

Functions

This section is empty.

Types

type LatLng

type LatLng struct {
	Latitude  float64 `json:"lat"` // in degrees
	Longitude float64 `json:"lng"` // in degrees
}

type Map

type Map struct {
	Center     LatLng     // where it looks
	Zoom       float32    // 0 means 12
	Markers    []Marker   // the pins
	Lines      []Polyline // routes and other lines
	MyLocation bool       // the blue dot; needs the location permission

	OnTap    func(LatLng)          // the map itself
	OnMarker func(id string)       // a pin
	OnMove   func(LatLng, float32) // after a pan or zoom ends, with the zoom
	Style    ui.Style              // the map's size and place on the screen
}

Map is a map. Changing Center or Zoom moves it there; panning by hand doesn't change them, and OnMove says where it stopped.

func (Map) Render

func (m Map) Render(c *ui.Ctx) ui.Component

Render shows the map.

type Marker

type Marker struct {
	ID    string `json:"id"`              // your name for it, sent to OnMarker
	At    LatLng `json:"at"`              // where it stands
	Title string `json:"title,omitempty"` // shown when tapped; optional
}

Marker is a pin.

type Polyline

type Polyline struct {
	Points []LatLng `json:"points"` // the places it goes through
	Color  ui.Color `json:"color"`  // the theme's Primary when 0
	Width  float32  `json:"width"`  // points; 0 means 4
}

Polyline is a line through places, such as a route.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL