Documentation
¶
Overview ¶
Package maps shows a map in a window's native UI: MapKit on iOS, and on Android osmdroid, with OpenStreetMap's tiles by default, which needs no account or key.
m, err := maps.New(win, maps.Options{Center: maps.LatLng{Lat: 48.86, Lng: 2.35}, Zoom: 12})
...
ui.WebView(c, m).Fill() // in the view; what it draws after shows over the map
m.OnTap(func(at maps.LatLng) { ... })
m.AddMarker(ctx, maps.Marker{ID: "home", At: at, Title: "Home"})
A finger pans, pinches and taps it. OpenStreetMap's tile servers are for light use: an app with many users gives Options.TileURL a server of its own (Android; iOS shows Apple's maps). On desktops and in browsers New reports errors.ErrUnsupported.
Index ¶
- type LatLng
- type Map
- func (m *Map) AddMarker(ctx context.Context, marker Marker) error
- func (m *Map) Camera(ctx context.Context) (center LatLng, zoom float64, err error)
- func (m *Map) Destroy()
- func (m *Map) OnMarkerTap(fn func(id string))
- func (m *Map) OnTap(fn func(at LatLng))
- func (m *Map) RemoveMarker(ctx context.Context, id string) error
- func (m *Map) SetCamera(ctx context.Context, center LatLng, zoom float64, animated bool) error
- func (m *Map) SurfaceWebView(conn *surface.Conn) platform.WebView
- type Marker
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a map in a window. Show it with ui.WebView.
func (*Map) Destroy ¶
func (m *Map) Destroy()
Destroy takes the map away, which closing its window doesn't: call it before.
func (*Map) OnMarkerTap ¶
OnMarkerTap calls fn on the main thread as a finger taps a pin.
func (*Map) OnTap ¶
OnTap calls fn on the main thread as a finger taps the map, not one of its pins.
func (*Map) RemoveMarker ¶
RemoveMarker takes a pin off the map.