mapping

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2017 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 *element.OSMElem, geom *geom.Geometry, match Match) interface{}

func Bool

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

func BoolInt

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

func DefaultWayZOrder

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

func Direction

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

func Geometry

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

func Id

func Id(val string, elem *element.OSMElem, geom *geom.Geometry, match Match) interface{}

func Integer

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

func KeyName

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

func RelationMemberID

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

func RelationMemberIndex

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

func RelationMemberRole

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

func RelationMemberType

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

func String

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

func ValueName

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

func WebmercArea

func WebmercArea(val string, elem *element.OSMElem, 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(*element.Relation, *element.Member, Match) interface{}

type MakeValue

type MakeValue func(string, *element.OSMElem, *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 NewMapping

func NewMapping(filename string) (*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 *element.Relation, member *element.Member, geom *geom.Geometry) []interface{}

func (*Match) Row

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

type NodeMatcher

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

type RelWayMatcher

type RelWayMatcher interface {
	WayMatcher
	RelationMatcher
}

type RelationMatcher

type RelationMatcher interface {
	MatchRelation(rel *element.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 *element.Tags)
}

type TagTableMapping

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

type Value

type Value string

type WayMatcher

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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