parser

package
v0.0.0-...-0968fc2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedRandomAccessParser

type CachedRandomAccessParser struct {
	Parser
	Index   *gosmparse.BlobIndex
	Mutex   *sync.Mutex
	Cache   *CoordCache
	Handler *CoordCacheHandler
}

CachedRandomAccessParser - struct to handle random access lookups to a pbf

func NewCachedRandomAccessParser

func NewCachedRandomAccessParser(path string, idxPath string) *CachedRandomAccessParser

NewCachedRandomAccessParser -

func (*CachedRandomAccessParser) ReadNode

func (p *CachedRandomAccessParser) ReadNode(osmID int64) (*gosmparse.Node, error)

ReadNode - fetch a single node

type CoordCache

type CoordCache struct {
	Mutex          *sync.Mutex
	Size           int
	ClearRatio     float64
	Coords         map[int64]*gosmparse.Node
	Fifo           []int64
	SeenMask       *lib.Bitmask
	DuplicatesMask *lib.Bitmask
}

CoordCache - in-memory element cache

func (*CoordCache) Get

func (c *CoordCache) Get(id int64) (*gosmparse.Node, bool)

Get - fetch a single record from the cache

func (*CoordCache) Set

func (c *CoordCache) Set(id int64, item gosmparse.Node)

Set - store a single record in the cache

type CoordCacheHandler

type CoordCacheHandler struct {
	Cache *CoordCache
	Mask  *lib.Bitmask
}

CoordCacheHandler - CoordCacheHandler

func (*CoordCacheHandler) ReadNode

func (h *CoordCacheHandler) ReadNode(item gosmparse.Node)

ReadNode - called once per node

func (*CoordCacheHandler) ReadRelation

func (h *CoordCacheHandler) ReadRelation(item gosmparse.Relation)

ReadRelation - called once per relation

func (*CoordCacheHandler) ReadWay

func (h *CoordCacheHandler) ReadWay(item gosmparse.Way)

ReadWay - called once per way

type Parser

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

Parser - PBF Parser

func NewParser

func NewParser(path string) *Parser

NewParser - Create a new parser for file at path

func NewParserFromArgs

func NewParserFromArgs(pos int) *Parser

NewParserFromArgs - Create a new parser for file at argv position

func (*Parser) GetDecoder

func (p *Parser) GetDecoder() *gosmparse.Decoder

GetDecoder - return decoder object

func (*Parser) Parse

func (p *Parser) Parse(handler gosmparse.OSMReader)

Parse - execute parser

func (*Parser) ParseBlob

func (p *Parser) ParseBlob(handler gosmparse.OSMReader, offset int64)

ParseBlob - execute parser for a single blob

func (*Parser) ParseFrom

func (p *Parser) ParseFrom(handler gosmparse.OSMReader, offset int64)

ParseFrom - execute parser, starting from offset

func (*Parser) Reset

func (p *Parser) Reset()

Reset - reset (open+close) file

type RandomAccessParser

type RandomAccessParser struct {
	Parser
	Index *gosmparse.BlobIndex
	Cache *handler.ReadAll
}

RandomAccessParser - struct to handle random access lookups to a pbf

func NewRandomAccessParser

func NewRandomAccessParser(path string, idxPath string) *RandomAccessParser

NewRandomAccessParser -

func (*RandomAccessParser) GetNode

func (p *RandomAccessParser) GetNode(osmID int64) (gosmparse.Node, error)

GetNode - fetch a single record from the file

func (*RandomAccessParser) GetRelation

func (p *RandomAccessParser) GetRelation(osmID int64) (gosmparse.Relation, error)

GetRelation - fetch a single record from the file

func (*RandomAccessParser) GetWay

func (p *RandomAccessParser) GetWay(osmID int64) (gosmparse.Way, error)

GetWay - fetch a single record from the file

Jump to

Keyboard shortcuts

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