0.2.0 • Published 3 years ago

nautical-charts v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

nautical-charts

GitHub Workflow Status npm GitHub

A pure JavaScript library for reading nautical chart files. In particular, for reading BSB-formatted (.bsb and .kap) files.

Installation

$ npm install nautical-charts --save

API Reference

Classes

Functions

MemoryStream

A readable stream for an in-memory byte array.

Kind: global class

new MemoryStream(contents, options)

The constructor for the MemoryStream

ParamDescription
contentsThe array from which to read.
optionsAn optional set of readable stream options.

parseChart(stream) ⇒

Parses a BSB chart from a readable (e.g. file) stream.

Kind: global function
Returns: A BSB chart.

ParamDescription
streamThe stream from which to read the chart data.

parseMetadata(textSegment) ⇒

Parses the text segment of a BSB chart and returns well-known metadata, if present.

Kind: global function
Returns: The metadata parsed from the chart.

ParamDescription
textSegmentThe text entries of the chart.

writeRasterSegment(rasterSegment, palette, buffer, bufferWidth)

Writes the RLE encoded raster data of a BSB chart to a bitmap.

Kind: global function

ParamDescription
rasterSegmentThe rows of raster data for the chart.
paletteThe palette from which to obtain pixel values.
bufferThe bitmap buffer in which to write the chart raster data.
bufferWidthThe width of the bitmap buffer.

License

MIT (see LICENSE.md)

0.2.0

3 years ago

0.1.0

3 years ago