mapboxglstyle

package
v0.0.0-...-14f1a14 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: LGPL-2.1 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FilterOperatorEquals   = "=="
	FilterOperatorNotEqual = "!="
	FilterOperatorAny      = "any"
	FilterOperatorAll      = "all"
	FilterOperatorIn       = "in"
	FilterOperatorNotIn    = "!in"
)
View Source
const (
	FilterCategoryType   = "$type"
	FilterTypePoint      = "Point"
	FilterTypeLineString = "LineString"
	FilterTypePolygon    = "Polygon"

	FilterCategoryClass        = "class"
	FilterCategorySubclass     = "subclass"
	FilterCategoryIntermittent = "intermittent"
	FilterCategoryBrunnel      = "brunnel"
	FilterCategoryAdminLevel   = "admin_level"
	FilterCategoryClaimedBy    = "claimed_by"
)
View Source
const (
	SourceLayerTransportation string = "transportation"
	SourceLayerWaterway       string = "waterway"
	SourceLayerPlace          string = "place"
)

https://openmaptiles.org/schema/#transportation

View Source
const (
	ObjectTypePoint      = "Point"
	ObjectTypeLineString = "LineString"
	ObjectTypePolygon    = "Polygon"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category interface {
	Matches(operandIdx int, sourceLayer string, objectTags []*ownmap.OSMTag, objectType ownmap.ObjectType) bool
	OperandCount() int
	GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType
}

type ClassCategory

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

func (ClassCategory) GetAllPossibleTagKeys

func (cc ClassCategory) GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType

func (ClassCategory) Matches

func (cc ClassCategory) Matches(operandIdx int, sourceLayer string, objectTags []*ownmap.OSMTag, objectType ownmap.ObjectType) bool

func (ClassCategory) OperandCount

func (cc ClassCategory) OperandCount() int

type ColorStopsType

type ColorStopsType struct {
	Stops []*colorStop `json:"stops"`
	Base  *float64     `json:"base"`
}

func (*ColorStopsType) GetValueAtZoomLevel

func (c *ColorStopsType) GetValueAtZoomLevel(zoomLevel ownmap.ZoomLevel) color.Color

GetValueAtZoomLevel returns the color at a given zoom level for this item. If no color (i.e. not shown), it returns nil

type ColorType

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

ColorType is the wrapper struct

func (*ColorType) GetColorAtZoomLevel

func (c *ColorType) GetColorAtZoomLevel(zoomLevel ownmap.ZoomLevel) color.Color

GetColorAtZoomLevel returns the color at a given zoom level. If there is no color, or if the zoom level doesn't match any of the color definitions, it will return nil

func (*ColorType) UnmarshalJSON

func (c *ColorType) UnmarshalJSON(data []byte) error

type ComparativeFilter

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

func (*ComparativeFilter) GetAllPossibleTagKeys

func (f *ComparativeFilter) GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType

func (*ComparativeFilter) IsObjectShown

func (f *ComparativeFilter) IsObjectShown(sourceLayer string, tags []*ownmap.OSMTag, objectFilterType ownmap.ObjectType) bool

func (*ComparativeFilter) Operator

func (f *ComparativeFilter) Operator() string

func (*ComparativeFilter) Type

func (f *ComparativeFilter) Type() FilterType

func (*ComparativeFilter) UnmarshalJSON

func (cf *ComparativeFilter) UnmarshalJSON(data []byte) error

type Filter

type Filter interface {
	Type() FilterType
	Operator() string
	GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType
	IsObjectShown(sourceLayer string, tags []*ownmap.OSMTag, objectFilterType ownmap.ObjectType) bool
}

type FilterContainer

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

func (FilterContainer) GetTagKeysToFetch

func (f FilterContainer) GetTagKeysToFetch(sourceLayer string) []*ownmapdal.TagKeyWithType

func (FilterContainer) IsObjectShown

func (f FilterContainer) IsObjectShown(sourceLayer string, tags []*ownmap.OSMTag, objectType ownmap.ObjectType) bool

func (*FilterContainer) UnmarshalJSON

func (f *FilterContainer) UnmarshalJSON(data []byte) error

type FilterType

type FilterType int
const (
	// FilterTypeLogical is a filter containing 2 (or more) sub-filters
	FilterTypeLogical FilterType = iota
	// FilterTypeComparative is a filter containing comparisions on e.g. object classes (it does not contain sub-filters)
	FilterTypeComparative
)

type Layer

type Layer struct {
	Filter      FilterContainer `json:"filter"`
	ID          LayerType       `json:"id"`
	Layout      Layout          `json:"layout"`
	MaxZoom     *float64        `json:"maxzoom"`
	Metadata    Metadata        `json:"metadata"`
	MinZoom     *float64        `json:"minzoom"`
	Paint       *Paint          `json:"paint"`
	Source      string          `json:"source"`
	SourceLayer string          `json:"source-layer"`
	Type        LayerType       `json:"type"`
}

func (*Layer) GetLayerNodeStyle

func (l *Layer) GetLayerNodeStyle(node *ownmap.OSMNode, zoomLevel ownmap.ZoomLevel, layerIndex int) *styling.NodeStyle

func (*Layer) GetLayerWayStyle

func (l *Layer) GetLayerWayStyle(tags []*ownmap.OSMTag, zoomLevel ownmap.ZoomLevel, layerIndex int) *styling.WayStyle

func (*Layer) Validate

func (l *Layer) Validate() errorsx.Error

type LayerType

type LayerType string
const (
	LayerTypeBackground    LayerType = "background"
	LayerTypeFill          LayerType = "fill"
	LayerTypeLine          LayerType = "line"
	LayerTypeSymbol        LayerType = "symbol"
	LayerTypeRaster        LayerType = "raster"
	LayerTypeCircle        LayerType = "circle"
	LayerTypeFillExtrusion LayerType = "fill-extrusion"
	LayerTypeHeatmap       LayerType = "heatmap"
	LayerTypeHillshade     LayerType = "hillshade"
)

type Layout

type Layout struct {
	Visibility            string                       `json:"visibility"`
	LineCap               string                       `json:"line-cap"`
	LineJoin              string                       `json:"line-join"`
	TextField             string                       `json:"text-field"`
	TextFont              []string                     `json:"text-font"`
	TextSize              *NumberOrFunctionWrapperType `json:"text-size"`        // float64 or {"base": 1.4, "stops": [[10, 8], [20, 14]]}
	SymbolPlacement       interface{}                  `json:"symbol-placement"` // string or {"base": 1, "stops": [[10, "point"], [11, "line"]]}
	TextLetterSpacing     float64                      `json:"text-letter-spacing"`
	TextRotationAlignment string                       `json:"text-rotation-alignment"`
	TextTransform         string                       `json:"text-transform"`
	IconSize              *NumberOrFunctionWrapperType `json:"icon-size"`
	TextAnchor            string                       `json:"text-anchor"`
	TextMaxWidth          float64                      `json:"text-max-width"`
	TextOffset            []float64                    `json:"text-offset"`
	SymbolSpacing         float64                      `json:"symbol-spacing"`
	IconImage             string                       `json:"icon-image"`
	TextPadding           float64                      `json:"text-padding"`
}

type Light

type Light struct {
	Anchor    string      `json:"anchor"`
	Color     color.Color `json:"color"`
	Intensity float64     `json:"intensity"`
	Position  []float64   `json:"position"`
}

type LogicalFilter

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

func (*LogicalFilter) GetAllPossibleTagKeys

func (f *LogicalFilter) GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType

func (*LogicalFilter) IsObjectShown

func (f *LogicalFilter) IsObjectShown(sourceLayer string, tags []*ownmap.OSMTag, objectFilterType ownmap.ObjectType) bool

func (*LogicalFilter) Operator

func (f *LogicalFilter) Operator() string

func (*LogicalFilter) Type

func (f *LogicalFilter) Type() FilterType

type MapboxGLStyle

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

MapboxGLStyle represents a stylesheet represented in the MapboxGL format. https://docs.mapbox.com/mapbox-gl-js/style-spec/ https://maputnik.github.io/editor

func Parse

func Parse(reader io.Reader) (*MapboxGLStyle, errorsx.Error)

func (*MapboxGLStyle) GetBackground

func (s *MapboxGLStyle) GetBackground() color.Color

func (*MapboxGLStyle) GetNodeStyle

func (s *MapboxGLStyle) GetNodeStyle(node *ownmap.OSMNode, zoomLevel ownmap.ZoomLevel) (*styling.NodeStyle, errorsx.Error)

func (*MapboxGLStyle) GetRelationStyle

func (s *MapboxGLStyle) GetRelationStyle(relationData *ownmap.RelationData, zoomLevel ownmap.ZoomLevel) (*styling.RelationStyle, errorsx.Error)

func (*MapboxGLStyle) GetStyleID

func (s *MapboxGLStyle) GetStyleID() string

func (*MapboxGLStyle) GetWantedObjects

func (s *MapboxGLStyle) GetWantedObjects(zoomLevel ownmap.ZoomLevel) []*ownmapdal.TagKeyWithType

func (*MapboxGLStyle) GetWayStyle

func (s *MapboxGLStyle) GetWayStyle(tags []*ownmap.OSMTag, zoomLevel ownmap.ZoomLevel) (*styling.WayStyle, errorsx.Error)

type Metadata

type Metadata map[string]interface{}

type NumberOrFunctionWrapperType

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

func (*NumberOrFunctionWrapperType) GetValueAtZoomLevel

func (n *NumberOrFunctionWrapperType) GetValueAtZoomLevel(zoomLevel ownmap.ZoomLevel) float64

func (*NumberOrFunctionWrapperType) UnmarshalJSON

func (n *NumberOrFunctionWrapperType) UnmarshalJSON(data []byte) error

type NumericFunctionType

type NumericFunctionType struct {
	Type  functionTypeName  `json:"type"`
	Base  *float64          `json:"base"` // the lowest value possible, if shown?
	Stops []numericStopType `json:"stops"`
}

func (NumericFunctionType) GetValueAtZoomLevel

func (s NumericFunctionType) GetValueAtZoomLevel(zoomLevel ownmap.ZoomLevel) float64

type Paint

type Paint struct {
	BackgroundColor *ColorType                   `json:"background-color"`
	FillColor       *ColorType                   `json:"fill-color"` // for example "hsl(47, 13%, 86%)"
	FillOpacity     *NumberOrFunctionWrapperType `json:"fill-opacity"`
	FillAntialias   interface{}                  `json:"fill-antialias"` // bool or e.g. {"base": 1, "stops": [[0, false], [9, true]]}
	LineColor       *ColorType                   `json:"line-color"`
	LineDashArray   []float64                    `json:"line-dasharray"`
	LineGapWidth    *NumberOrFunctionWrapperType `json:"line-gap-width"`
	LineOpacity     *NumberOrFunctionWrapperType `json:"line-opacity"` // either float64, or like {"base": 1, "stops": [[11, 0], [16, 1]]}
	LineOffset      *float64                     `json:"line-offset"`
	LineWidth       *NumberOrFunctionWrapperType `json:"line-width"`
	// FillOutlineColor *ColorStopsType              `json:"fill-outline-color"`
	FillOutlineColor *ColorType  `json:"fill-outline-color"`
	FillTranslate    interface{} `json:"fill-translate"`
	FillPattern      interface{} `json:"fill-pattern"`
	TextColor        *ColorType  `json:"text-color"`
	TextHaloBlur     *float64    `json:"text-halo-blur"`
	TextHaloColor    *ColorType  `json:"text-halo-color"`
	TextHaloWidth    *float64    `json:"text-halo-width"`
}

type Source

type Source struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

type Sources

type Sources map[string]Source

type SubClassCategory

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

func (SubClassCategory) GetAllPossibleTagKeys

func (scc SubClassCategory) GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType

func (SubClassCategory) Matches

func (scc SubClassCategory) Matches(operandIdx int, sourceLayer string, objectTags []*ownmap.OSMTag, objectType ownmap.ObjectType) bool

func (SubClassCategory) OperandCount

func (scc SubClassCategory) OperandCount() int

type TagWithObjectTypes

type TagWithObjectTypes struct {
	Tag         *ownmap.OSMTag
	ObjectTypes []ownmap.ObjectType
}

type Transition

type Transition struct {
	Delay    int `json:"delay"`    // milliseconds
	Duration int `json:"duration"` // milliseconds
}

type TypeCategory

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

func (TypeCategory) GetAllPossibleTagKeys

func (TypeCategory) GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType

func (TypeCategory) Matches

func (tc TypeCategory) Matches(operandIdx int, sourceLayer string, objectTags []*ownmap.OSMTag, objectType ownmap.ObjectType) bool

func (TypeCategory) OperandCount

func (tc TypeCategory) OperandCount() int

type UnhandledCategory

type UnhandledCategory struct{}

func (UnhandledCategory) GetAllPossibleTagKeys

func (UnhandledCategory) GetAllPossibleTagKeys(sourceLayer string) []*ownmapdal.TagKeyWithType

func (UnhandledCategory) Matches

func (UnhandledCategory) Matches(operandIdx int, sourceLayer string, objectTags []*ownmap.OSMTag, objectType ownmap.ObjectType) bool

func (UnhandledCategory) OperandCount

func (cc UnhandledCategory) OperandCount() int

Jump to

Keyboard shortcuts

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