ownmapdal

package
v0.0.0-...-debf9f8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: LGPL-2.1 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectionPathSeparator = "://"
View Source
const (
	PBFFileSuffix = ".pbf"
)

Variables

View Source
var (
	ErrNoDataAvailable = errors.New("no data available")
)

Functions

func GenerateFilePathForNewDiskFile

func GenerateFilePathForNewDiskFile(dirPath, fileName, suffix string) (string, errorsx.Error)

Types

type ChosenConnForBounds

type ChosenConnForBounds struct {
	MatchLevel MatchLevel
	DataSourceConn
}

type DBConnSet

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

func NewDBConnSet

func NewDBConnSet(conns []DataSourceConn) *DBConnSet

func (*DBConnSet) AddDBConn

func (dbcs *DBConnSet) AddDBConn(conn DataSourceConn)

func (*DBConnSet) GetConns

func (dbcs *DBConnSet) GetConns() []DataSourceConn

func (*DBConnSet) GetConnsForBounds

func (dbcs *DBConnSet) GetConnsForBounds(bounds osm.Bounds) ([]*ChosenConnForBounds, errorsx.Error)

GetConnForBounds selects a connection to use to provide data for a given bounds

type DBFileConnectionURL

type DBFileConnectionURL struct {
	Type           DBFileType
	ConnectionPath string
}

func ParseDBConnFilePath

func ParseDBConnFilePath(str string) (DBFileConnectionURL, errorsx.Error)

type DBFileType

type DBFileType string
const (
	DBFileTypeMapmakerDB DBFileType = "ownmapdb"
	DBFileTypePostgresql DBFileType = "postgresql"
)

type DataSourceConn

type DataSourceConn interface {
	// Info methods
	Name() string
	DatasetInfo() (*ownmap.DatasetInfo, errorsx.Error)

	// Data fetch methods
	GetInBounds(ctx context.Context, bounds osm.Bounds, filter *GetInBoundsFilter) (TagNodeMap, TagWayMap, TagRelationMap, errorsx.Error)
}

func Import

func Import(
	logger *logpkg.Logger,
	pbfReader PBFReader,
	fs gofs.Fs,
	importer Importer,
	bounds osm.Bounds,
) (DataSourceConn, errorsx.Error)

type DefaultPBFReader

type DefaultPBFReader struct {
	*osmpbf.Scanner
	// contains filtered or unexported fields
}

func NewDefaultPBFReader

func NewDefaultPBFReader(file gofs.File) (*DefaultPBFReader, errorsx.Error)

func (*DefaultPBFReader) Reset

func (r *DefaultPBFReader) Reset() errorsx.Error

func (*DefaultPBFReader) TotalSize

func (r *DefaultPBFReader) TotalSize() int64

type GetInBoundsFilter

type GetInBoundsFilter struct {
	Objects []*TagKeyWithType
}

func (*GetInBoundsFilter) Filter

func (f *GetInBoundsFilter) Filter(objectType ownmap.ObjectType, tagKey ownmap.TagKey) bool

returns true if the object should be fetched

type GetNodeByIDType

type GetNodeByIDType func(id int64) (*ownmap.OSMNode, errorsx.Error)

type GetRelationByIDType

type GetRelationByIDType func(id int64) (*ownmap.OSMRelation, errorsx.Error)

type GetWayByIDType

type GetWayByIDType func(id int64) (*ownmap.OSMWay, errorsx.Error)

type ImportQueue

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

func NewImportQueue

func NewImportQueue(pathsConfig *PathsConfig) *ImportQueue

func (*ImportQueue) AddItemToQueue

func (q *ImportQueue) AddItemToQueue(rawData io.Reader, fileName string, processFunc ProcessImportFunc, onImportedSuccessfully OnImportedSuccessfullyFunc) errorsx.Error

func (*ImportQueue) GetItems

func (q *ImportQueue) GetItems() []*ImportQueueItem

type ImportQueueItem

type ImportQueueItem struct {
	RawDataFilePath string
	Status          ImportStatus
	ProgressPercent float64
	TimeInProgress  time.Duration
	// contains filtered or unexported fields
}

type ImportRunType

type ImportRunType struct {
	Bounds             osm.Bounds
	RequiredTagKeysMap map[string]bool
	Rescan             *Rescan
	MaxItemsPerBatch   uint64
}

func (*ImportRunType) Validate

func (importRun *ImportRunType) Validate() errorsx.Error

type ImportStatus

type ImportStatus int
const (
	ImportStatusQueued     ImportStatus = 1
	ImportStatusInProgress ImportStatus = 2
	ImportStatusDone       ImportStatus = 3
)

func (ImportStatus) String

func (i ImportStatus) String() string

type Importer

type Importer interface {
	GetNodeByID(id int64) (*ownmap.OSMNode, error)
	GetWayByID(id int64) (*ownmap.OSMWay, error)
	GetRelationByID(id int64) (*ownmap.OSMRelation, error)
	ImportNode(obj *ownmap.OSMNode) errorsx.Error
	ImportWay(obj *ownmap.OSMWay) errorsx.Error
	ImportRelation(obj *ownmap.OSMRelation) errorsx.Error
	Commit() (DataSourceConn, errorsx.Error)
	Rollback() errorsx.Error
}

type MatchLevel

type MatchLevel int
const (
	MatchLevelNone MatchLevel = iota
	MatchLevelPartial
	MatchLevelFull
)

func (MatchLevel) String

func (i MatchLevel) String() string

type NodeOccurenceMap

type NodeOccurenceMap map[ownmap.TagKey]*ownmap.IndexIDList

type OnImportedSuccessfullyFunc

type OnImportedSuccessfullyFunc func(dataSource DataSourceConn)

type OnNodeReceivedFuncType

type OnNodeReceivedFuncType func(node *ownmap.OSMNode) errorsx.Error

type OnRelationReceivedFuncType

type OnRelationReceivedFuncType func(relation *ownmap.OSMRelation, nodes []*ownmap.OSMNode) errorsx.Error

type OnWayReceivedFuncType

type OnWayReceivedFuncType func(way *ownmap.OSMWay, nodes []*ownmap.OSMNode) errorsx.Error

type PBFReader

type PBFReader interface {
	Header() (*osmpbf.Header, error)
	Scan() bool
	Object() osm.Object
	Err() error
	Reset() errorsx.Error
	FullyScannedBytes() int64
	TotalSize() int64
}

type PathsConfig

type PathsConfig struct {
	StylesDir       string
	DataDir         string
	RawDataFilesDir string
	TempDir         string
	TraceDir        string
}

func (*PathsConfig) EnsurePaths

func (pc *PathsConfig) EnsurePaths() errorsx.Error

type ProcessImportFunc

type ProcessImportFunc func(pbfReader PBFReader) (DataSourceConn, errorsx.Error)

type ReadDAL

type ReadDAL interface {
	GetInBounds(dataSourceConn DataSourceConn, bounds osm.Bounds, filter *GetInBoundsFilter) (NodeOccurenceMap, WayOccurenceMap, errorsx.Error)
	GetNodeMapFromTagOccurences(dataSourceConn DataSourceConn, tagOccurenceMap NodeOccurenceMap) (TagNodeMap, errorsx.Error)
	GetWayMapFromTagOccurences(dataSourceConn DataSourceConn, tagOccurenceMap WayOccurenceMap) (TagWayMap, errorsx.Error)
	GetDatasetInfo(dataSourceConn DataSourceConn) (*ownmap.DatasetInfo, errorsx.Error)
}

type Rescan

type Rescan struct {
	WayRescanMap, RelationRescanMap *RescanMap
}

func NewRescan

func NewRescan() *Rescan

func (*Rescan) GetRescanItemRequestsThisIteration

func (r *Rescan) GetRescanItemRequestsThisIteration() int64

func (*Rescan) MarkNewIteration

func (r *Rescan) MarkNewIteration()

type RescanMap

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

func NewRescanMap

func NewRescanMap() *RescanMap

func (*RescanMap) GetValueOfWayMarkedForRescan

func (r *RescanMap) GetValueOfWayMarkedForRescan(id int64) RescanResult

func (*RescanMap) IsItemRequestedForRescan

func (r *RescanMap) IsItemRequestedForRescan(id int64) bool

func (*RescanMap) MarkIDAsScannedButNotInBounds

func (r *RescanMap) MarkIDAsScannedButNotInBounds(id int64)

func (*RescanMap) RequestIDToBeRescanned

func (r *RescanMap) RequestIDToBeRescanned(id int64)

RequestWayIDToBeRescanned marks a Way ID to be rescanned

type RescanResult

type RescanResult struct {
	KnownToBeOutOfBounds bool
	// contains filtered or unexported fields
}

type TagKeyWithType

type TagKeyWithType struct {
	ObjectType ownmap.ObjectType
	TagKey     ownmap.TagKey
}

type TagNodeMap

type TagNodeMap map[ownmap.TagKey][]*ownmap.OSMNode

type TagRelationMap

type TagRelationMap map[ownmap.TagKey][]*ownmap.RelationData

type TagWayMap

type TagWayMap map[ownmap.TagKey][]*ownmap.OSMWay

type WayOccurenceMap

type WayOccurenceMap map[ownmap.TagKey]*ownmap.IndexIDList

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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