builder

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package builder implements converter from CartoCSS to Mapnik/MapServer styles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMapFromString

func BuildMapFromString(m Map, mml *mml.MML, style string) error

BuildMapFromString parses the style from a string and adds all mml.Layers to the map.

Types

type Builder

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

Builder builds map styles from MML and MSS files.

func New

func New(mw Map) *Builder

New returns a Builder

func (*Builder) AddMSS

func (b *Builder) AddMSS(mss string)

AddMSS adds another mss file to this builder.

func (*Builder) Build

func (b *Builder) Build() error

Build parses MML, MSS files, builds all rules and adds them to the Map.

func (*Builder) SetDumpRulesDest

func (b *Builder) SetDumpRulesDest(w io.Writer)

SetDumpRulesDest enables internal debuging output.

func (*Builder) SetIncludeInactive

func (b *Builder) SetIncludeInactive(includeInactive bool)

SetIncludeInactive set whether status=off layers should be included in output.

func (*Builder) SetMML

func (b *Builder) SetMML(mml string)

SetMML sets/overwirtes the mml file of this builder.

type Cache

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

Cache builds styles and caches the results. It automatically detects changes to the MSS and MML files and rebuilds styles if requested again.

func NewCache

func NewCache(newLocator locatorCreator) *Cache

func (*Cache) ClearAll

func (c *Cache) ClearAll()

ClearAll removes all cached styles. Needs to be called before shutdown to prevent leaking temp files when used _without_ SetDestination. Will remove all cached styles from cache dir when used _with_ SetDestination.

func (*Cache) ClearTill

func (c *Cache) ClearTill(till time.Time)

ClearTill removes all cached styles that are older then till.

func (*Cache) SetDestination

func (c *Cache) SetDestination(dest string)

func (*Cache) StyleFile

func (c *Cache) StyleFile(mm MapMaker, mml string, mss []string) (string, error)

StyleFile returns the filename of the build result. (Re)builds style if required.

type FilesMissingError

type FilesMissingError struct {
	Files []string
}

func (*FilesMissingError) Error

func (e *FilesMissingError) Error() string

type Map

type Map interface {
	AddLayer(mml.Layer, []mss.Rule)
}

type MapMaker

type MapMaker interface {
	New(config.Locator) MapWriter
	// Type returns a unique string for this MapMaker, used for caching generated styles.
	Type() string
	FileSuffix() string
}

MapMaker creates new MapWriters.

type MapOptionsSetter

type MapOptionsSetter interface {
	SetBackgroundColor(color.Color)
}

type MapWriter

type MapWriter interface {
	Writer
	Map
}

type MapZoomScaleSetter

type MapZoomScaleSetter interface {
	SetZoomScales([]int)
}

type Update

type Update struct {
	Err        error
	Time       time.Time
	UpdatedMML bool
}

type Writer

type Writer interface {
	Write(io.Writer) error
	WriteFiles(basename string) error
}

Directories

Path Synopsis
Package mapserver builds Mapnik .xml files.
Package mapserver builds Mapnik .xml files.
Package mapserver builds MapServer .map files.
Package mapserver builds MapServer .map files.
Package sql modifies SQL queries.
Package sql modifies SQL queries.

Jump to

Keyboard shortcuts

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