mapnik

package module
v0.0.0-...-5a4c768 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 9 Imported by: 0

README

go-mapnik

Import

CGO_ENABLED="0" go get gitlab.ozon.ru/osm/go-mapnik

Installation

This package requires Mapnik (libmapnik-dev on Ubuntu/Debian, mapnik in Homebrew). Make sure mapnik-config is in your PATH.

You need to set the CGO_LDFLAGS and CGO_CXXFLAGS environment variables for successful compilation and linking with Mapnik. Refer to the Makefile how mapnik-config can be used to extract the required CGO_LDFLAGS and CGO_CXXFLAGS values.

Example:

export CGO_LDFLAGS=$(shell mapnik-config --libs)
export CGO_CXXFLAGS=$(shell mapnik-config --cxxflags --includes --dep-includes | tr '\n' ' ')

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMapnikError = errors.New("mapnik")

Functions

func ConfigFonts

func ConfigFonts() string

func ConfigPlugins

func ConfigPlugins() string

func RegisterDatasources

func RegisterDatasources(path string) error

func RegisterFonts

func RegisterFonts(path string) error

func SetLogLevel

func SetLogLevel(level LogLevel)

func Version

func Version() string

Types

type ImageFormat

type ImageFormat string
const (
	Png256 ImageFormat = "png256"

	Jpeg100 ImageFormat = "jpeg100"
	Jpeg80  ImageFormat = "jpeg80"
)

func (ImageFormat) String

func (f ImageFormat) String() string

type LogLevel

type LogLevel int
const (
	LogLevelNone  LogLevel = 0
	LogLevelDebug LogLevel = 1
	LogLevelWarn  LogLevel = 2
	LogLevelError LogLevel = 3
)

type Map

type Map struct {
	// contains filtered or unexported fields
}

func NewMap

func NewMap(width, height uint32) *Map

func (*Map) Free

func (m *Map) Free()

func (*Map) Load

func (m *Map) Load(stylesheetFile string) error

Load initializes the map by loading its stylesheet from stylesheetFile

func (*Map) LoadString

func (m *Map) LoadString(stylesheet string) error

LoadString initializes the map not from a file but from a stylesheet provided as a string.

func (*Map) Projection

func (m *Map) Projection() *Projection

func (*Map) Render

func (m *Map) Render(opts RenderOpts) ([]byte, error)

Render returns the map as an encoded image.

func (*Map) RenderToFile

func (m *Map) RenderToFile(path string) error

func (*Map) Resize

func (m *Map) Resize(width, height uint32)

func (*Map) SRS

func (m *Map) SRS() string

func (*Map) SetBufferSize

func (m *Map) SetBufferSize(s int)

func (*Map) SetMaxConnections

func (m *Map) SetMaxConnections(count int)

func (*Map) SetSRS

func (m *Map) SetSRS(srs string)

func (*Map) Zoom

func (m *Map) Zoom(minx, miny, maxx, maxy float64)

func (*Map) ZoomAll

func (m *Map) ZoomAll() error

type Projection

type Projection struct {
	// contains filtered or unexported fields
}

Projection from one reference system to the other.

func (Projection) Forward

func (p Projection) Forward(x, y float64) (_x, _y float64)

func (*Projection) Free

func (p *Projection) Free()

type RenderOpts

type RenderOpts struct {
	Scale       float64
	ScaleFactor float64
	Format      ImageFormat // Format for the image ('jpeg80', 'png256', etc.)
}

Jump to

Keyboard shortcuts

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