[][src]Module vadeen_osm::osm_io

IO functionality for OSM maps.

You create readers or writers with the create_reader and create_writer functions. These returns readers and writers appropriate to the input or output format specified.

The input and output format is defined by the FileFormat enum. This can either be specified explicitly or parsed from a path or string.

Error handling is defined in the error module.

Examples

Convert a .osm file to a .o5m file.

// Read map from map.osm
let path = Path::new("map.osm");
let format = path.try_into().unwrap(); // Parse input format from path.
let file = File::open(path).unwrap();
let mut reader = create_reader(BufReader::new(file), format);
let osm = reader.read().unwrap();

// Write map to map.o5m
let path = Path::new("map.o5m");
let output = File::create(path).unwrap();
let mut writer = create_writer(output, FileFormat::O5m);
writer.write(&osm);

Modules

error

Enums

FileFormat

Represent a osm file format.

Traits

OsmReader

Reader for the osm formats.

OsmWriter

Writer for the osm formats.

Functions

create_reader
create_writer

Creates an OsmWriter appropriate to the provided FileFormat.