decoder

package
v0.0.0-...-63ab681 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2017 License: MIT Imports: 11 Imported by: 2

Documentation

Overview

Package osmpbf decodes OpenStreetMap (OSM) PBF files. Use this package by creating a NewDecoder and passing it a PBF file. Use Start to start decoding process. Use Decode to return Node, Way and Relation structs.

Index

Constants

View Source
const (

	// MaxBlobSize is maximum supported blob size.
	MaxBlobSize = 32 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundingBox

type BoundingBox struct {
	Left   float64
	Right  float64
	Top    float64
	Bottom float64
}
type Header struct {
	BoundingBox                      *BoundingBox
	RequiredFeatures                 []string
	OptionalFeatures                 []string
	WritingProgram                   string
	Source                           string
	OsmosisReplicationTimestamp      time.Time
	OsmosisReplicationSequenceNumber int64
	OsmosisReplicationBaseUrl        string
}

type Pbf

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

A Pbf reads and decodes OpenStreetMap PBF data from an input stream.

func NewDecoder

func NewDecoder(r io.Reader) *Pbf

NewDecoder returns a new decoder that reads from r.

func (*Pbf) Decode

func (dec *Pbf) Decode() (interface{}, error)

Decode reads the next object from the input stream and returns either a pointer to Node, Way or Relation struct representing the underlying OpenStreetMap PBF data, or error encountered. The end of the input stream is reported by an io.EOF error.

Decode is safe for parallel execution. Only first error encountered will be returned, subsequent invocations will return io.EOF.

func (*Pbf) Header

func (dec *Pbf) Header() (*Header, error)

Header returns file header.

func (*Pbf) SetBufferSize

func (dec *Pbf) SetBufferSize(n int)

SetBufferSize sets initial size of decoding buffer. Default value is 1MB, you can set higher value (for example, MaxBlobSize) for (probably) faster decoding, or lower value for reduced memory consumption. Any value will produce valid results; buffer will grow automatically if required.

func (*Pbf) Start

func (dec *Pbf) Start(n int) error

Start decoding process using n goroutines.

Directories

Path Synopsis
Package OSMPBF is a generated protocol buffer package.
Package OSMPBF is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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