mapping

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package mapping provides implements mapping and convertion between OSM elements and database tables, rows and columns.

The core logic of Imposm is accesible with the Mapping struct. A Mapping creates filters and matchers based on mapping configuration (.yaml or .json file).

Filters are for initial filtering (during -read). They remove all tags that are not needed.

Matchers map OSM elements to zero or more destination tables. Each Match results can convert an OSM element to a row with all mapped column values. The matching is dependend on the element type (node, way, relation), the element tags and the destination table type (point, linestring, polygon, relation, relation_member).

Index

Constants

This section is empty.

Variables

View Source
var AvailableColumnTypes map[string]ColumnType

Functions

func Area

func Area(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func Bool

func Bool(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func BoolInt

func BoolInt(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func DefaultWayZOrder

func DefaultWayZOrder(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func Direction

func Direction(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func Geometry

func Geometry(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func ID added in v0.7.0

func ID(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func Integer

func Integer(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func KeyName

func KeyName(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func RelationMemberID

func RelationMemberID(rel *osm.Relation, member *osm.Member, match Match) interface{}

func RelationMemberIndex

func RelationMemberIndex(rel *osm.Relation, member *osm.Member, match Match) interface{}

func RelationMemberRole

func RelationMemberRole(rel *osm.Relation, member *osm.Member, match Match) interface{}

func RelationMemberType

func RelationMemberType(rel *osm.Relation, member *osm.Member, match Match) interface{}

func String

func String(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func ValueName

func ValueName(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

func WebmercArea

func WebmercArea(val string, elem *osm.Element, geom *geom.Geometry, match Match) interface{}

Types

type ColumnType

type ColumnType struct {
	Name       string
	GoType     string
	Func       MakeValue
	MakeFunc   MakeMakeValue
	MemberFunc MakeMemberValue
	FromMember bool
}

func MakeColumnType

func MakeColumnType(c *config.Column) (*ColumnType, error)

type DestTable

type DestTable struct {
	Name       string
	SubMapping string
}

type Key

type Key string

type MakeMakeValue

type MakeMakeValue func(string, ColumnType, config.Column) (MakeValue, error)

type MakeMemberValue

type MakeMemberValue func(*osm.Relation, *osm.Member, Match) interface{}

type MakeValue

type MakeValue func(string, *osm.Element, *geom.Geometry, Match) interface{}

func MakeEnumerate

func MakeEnumerate(columnName string, columnType ColumnType, column config.Column) (MakeValue, error)

func MakeHStoreString

func MakeHStoreString(columnName string, columnType ColumnType, column config.Column) (MakeValue, error)

func MakePseudoArea

func MakePseudoArea(columnName string, columnType ColumnType, column config.Column) (MakeValue, error)

func MakeSuffixReplace

func MakeSuffixReplace(columnName string, columnType ColumnType, column config.Column) (MakeValue, error)

func MakeWayZOrder

func MakeWayZOrder(columnName string, columnType ColumnType, column config.Column) (MakeValue, error)

func MakeZOrder

func MakeZOrder(columnName string, columnType ColumnType, column config.Column) (MakeValue, error)

type Mapping

type Mapping struct {
	Conf                  config.Mapping
	PointMatcher          NodeMatcher
	LineStringMatcher     WayMatcher
	PolygonMatcher        RelWayMatcher
	RelationMatcher       RelationMatcher
	RelationMemberMatcher RelationMatcher
}

func FromFile added in v0.7.0

func FromFile(filename string) (*Mapping, error)

func New added in v0.7.0

func New(b []byte) (*Mapping, error)

func (*Mapping) NodeTagFilter

func (m *Mapping) NodeTagFilter() TagFilterer

func (*Mapping) RelationTagFilter

func (m *Mapping) RelationTagFilter() TagFilterer

func (*Mapping) WayTagFilter

func (m *Mapping) WayTagFilter() TagFilterer

type Match

type Match struct {
	Key   string
	Value string
	Table DestTable
	// contains filtered or unexported fields
}

func (*Match) MemberRow

func (m *Match) MemberRow(rel *osm.Relation, member *osm.Member, geom *geom.Geometry) []interface{}

func (*Match) Row

func (m *Match) Row(elem *osm.Element, geom *geom.Geometry) []interface{}

type NodeMatcher

type NodeMatcher interface {
	MatchNode(node *osm.Node) []Match
}

type RelWayMatcher

type RelWayMatcher interface {
	WayMatcher
	RelationMatcher
}

type RelationMatcher

type RelationMatcher interface {
	MatchRelation(rel *osm.Relation) []Match
}

type TableType

type TableType string
const (
	PolygonTable        TableType = "polygon"
	LineStringTable     TableType = "linestring"
	PointTable          TableType = "point"
	GeometryTable       TableType = "geometry"
	RelationTable       TableType = "relation"
	RelationMemberTable TableType = "relation_member"
)

func (*TableType) UnmarshalJSON

func (tt *TableType) UnmarshalJSON(data []byte) error

type TagFilterer

type TagFilterer interface {
	Filter(tags *osm.Tags)
}

type TagTableMapping

type TagTableMapping map[Key]map[Value][]orderedDestTable

type Value

type Value string

type WayMatcher

type WayMatcher interface {
	MatchWay(way *osm.Way) []Match
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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