Documentation ¶
Overview ¶
Package onmap puts pins into a world map image.
Index ¶
- Variables
- func DefaultMap() image.Image
- func DefaultPin() []image.Image
- func MapPins(worldMap image.Image, pinParts []image.Image, coords []Coord, crop *CropOption) image.Image
- func MapPinsProjection(proj Projection, worldMap image.Image, pinParts []image.Image, coords []Coord, ...) image.Image
- func Pins(coords []Coord, crop *CropOption) image.Image
- type Coord
- type CropOption
- type Projection
Constants ¶
This section is empty.
Variables ¶
var Mercator = mercatorProjection(0)
Mercator provides the Mercator projection.
var StandardCrop = &CropOption{ Bound: 100, MinWidth: 640, MinHeight: 543, PreserveRatio: true, }
StandardCrop is the standard crop.
Functions ¶
func DefaultMap ¶ added in v1.4.0
DefaultMap returns the default map (Mercator projection).
func DefaultPin ¶ added in v1.4.0
DefaultPin returns default pin images.
func MapPins ¶
func MapPins(worldMap image.Image, pinParts []image.Image, coords []Coord, crop *CropOption) image.Image
MapPins is like MapPinsProjection with Mercator projection. The world map must be in the same projection.
func MapPinsProjection ¶ added in v1.1.0
func MapPinsProjection(proj Projection, worldMap image.Image, pinParts []image.Image, coords []Coord, crop *CropOption) image.Image
MapPinsProjection returns an image with the given coordinates marked as pins on the given world map. If crop is nil, doesn't crop the image.
World map must be in the given projection.
Pin parts are arbitrary pin images, usually a shadow of the pin and the pin itself. Pin parts are drawn on top of each other from the bottom of the map to the top by first drawing pinParts[n], then pinParts[n+1], etc. The coordinate point is at the bottom center of each pin part image.
Types ¶
type CropOption ¶
type CropOption struct { // Bound is a minimum distance from the pin to the image boundary. Bound int // MinWidth is a minimum width of image. MinWidth int // MinHeight is a minimum height of image. MinHeight int // If PreserveRatio is true, the image preserves the ratio between // MinWidth and MinHeight. // // MinHeight must be less than MinWidth for this to work correctly. PreserveRatio bool }
CropOptions defines options for cropping the map image.