gpxio

package
v0.0.0-...-b528ac3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(r io.Reader) (gpxFiles []gpx.GPX, err error)

Read reads gpx data that is written, e.g., to STDIN. If multiple gpx files are written to the reader, it separates those based on the ending tag "</gpx>"

func ReadFile

func ReadFile(fileName string) (gpxFile gpx.GPX, err error)

ReadFile reads a single file from the file system that is identified with the provided fileName

func ReadFileSystem

func ReadFileSystem(fileName string) (gpxFiles []gpx.GPX, err error)

ReadFileSystem reads file(s) from the filesystem using the provided path (fileName). If fileName is a folder, it reads all top-level files ending with ".gpx" or ".GPX" in that folder

func ReadFolder

func ReadFolder(folderName string) (gpxFiles []gpx.GPX, err error)

ReadFolder reads the GPX files (ending with ".gpx" or ".GPX") of a folder (without recursion) and returns their contents

func WriteFiles

func WriteFiles(fileName string, outFiles []gpx.GPX) (err error)

func WriteStdout

func WriteStdout(outFiles []gpx.GPX) (err error)

Types

type DelimReader

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

A custom reader that tries to separate, e.g., multiple GPX files from a single stream. This is done by searching for a delimiter.

func NewDelimReader

func NewDelimReader(reader *bufio.Reader, delimiter []byte) DelimReader

NewDelimReader creates a new DelimReader that reads from reader and splits based on the provided delimiter.

The delimiter's last byte must not occur in previous bytes of the delimiter. This works, e.g., if delim is "</gpx>", as ">" only occurs once.

func NewGPXReader

func NewGPXReader(reader *bufio.Reader) DelimReader

NewGPXReader creates a new DelimReader that reads from reader and splits concatenated GPX files.

func (DelimReader) ReadToNextDelim

func (s DelimReader) ReadToNextDelim() (p []byte, err error)

ReadToNextDelim reads to the next full delimiter and returns all bytes that came before (including the delimiter). Reads until EOF and also returns the rest between the last delimiter and EOF. Returns err as io.EOF, if the end of the file is reached.

Jump to

Keyboard shortcuts

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