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 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.
Click to show internal directories.
Click to hide internal directories.