garmin_img 0.0.18
garmin_img: ^0.0.18 copied to clipboard
Pure-Dart reader for unlocked Garmin .img maps. Decodes TRE, RGN, LBL, TYP and DEM subfiles into typed points, polylines, polygons and elevations.
0.0.18 #
- pub.dev polish: shorter package description, a canonical
example/garmin_img_example.dartAPI tour (plusexample/README.md), and dartdoc on every public field/constructor (BoundingBox,LatLng,ImgFeature,MapLevel,Subdivision,DemTile,DemLevel,ImgMap). - Examples no longer fall back to hard-coded local paths; they print usage.
0.0.17 #
- Fix polygon type aliasing: polygon types are 7 bits (only POLYLINES use
bit 6 as a direction flag), but the decoder masked both with
0x3f. Every landcover type ≥ 0x40 was aliased — 0x50 woods → 0x10 "residential", 0x4b background → 0x0b, 0x4e farmland → 0x0e, 0x4d glacier → 0x0d — which mis-coloured or dropped most of an OpenTopoMap-style map's terrain (and made its TYP colour lookups miss). Verified on OTM Switzerland: forest (0x50, TYP green) now covers 42% of a lowland sample that previously showed ~8%.
0.0.16 #
- Decode the DEM subfile (digital elevation model). OpenTopoMap-class maps
store their relief here — not as vector contours — so
map.demnow exposes the elevation pyramid.GarminDem.elevationAt(lat, lng)samples a metre height anddecodeTile(...)returns a tile's raster grid, for hillshade/contour rendering. The per-tile bitstream is JPEG-LS (JLS: median-edge prediction + Golomb-Rice); the decoder is a faithful port of GPXSee's reference implementation. Verified against known Swiss elevations (Bern 542m, Zermatt 1605m, Interlaken 567m, Zürich 410m). Classic-FAT maps only for now (GMP DEM pointer not yet wired).
0.0.15 #
featuresInBoundsgains apointsOnlyflag that skips line/polygon geometry decode entirely — much faster when a consumer only needs POI points (e.g. a marker overlay drawn separately from a raster terrain layer).
0.0.14 #
- Add
GarminImg.pointIcons— decodes the map's embedded TYP point/POI icon bitmaps into RGBA, keyed by TYP typecode(type << 5) | subtype. Handles the colour-mode bpp table (mode 0x10 uses 4bpp for 3–14 colours, etc.), BGR palettes, per-mode transparency, and byte-aligned LSB-first rows (per QMapShack's decoder). Lets consumers render each map's own symbols (hut, spring, church, cave …) instead of hardcoding icons.
0.0.13 #
- Support classic-format
.imgmaps (separate.TRE/.RGN/.LBLsubfiles listed in the IMG FAT), in addition to the NT/GMP container. The reader now walks the FAT — block size1 << (E1+E2)from header 0x61/0x62, 512-byte directory entries at 0x1000 — pairs each sub-map's TRE/RGN/LBL by filename, and decodes them with per-subfile section bases. This opens common topo maps like BGMountains (165 sub-maps) that have no GMP container. GMP images are unchanged (FAT walk finds no TRE subfiles → falls back to the GMP scan).
0.0.12 #
- Fix point/POI decoding. The has-subtype and POI flags live in the 3-byte label info (bits 23/22), not the type byte; the full type byte is the "fulltipo" high byte (so summits are 0x6616 / 0x6300). POI labels are an indirection (offset → POI section → real LBL1 offset) — decode them properly instead of reading raw bytes, which fixes truncated/garbled POI names.
0.0.11 #
- Add
GarminImg.polygonNames(type → TYP name, e.g. "FOREST", "ROCKS") so consumers can pick semantics the color alone can't (forest vs grass).
0.0.10 #
- Decode LBL labels per the map's codepage (u16 @ LBL+0xaa): Windows-1251 → Cyrillic, 65001 → UTF-8, else Latin (cp1252). Latin and Cyrillic editions of a map differ only in this field, so both now read correctly.
0.0.9 #
- Port the coordinate bitstream decoder faithfully from org.free.garminimg: add the variable-length "escape" case in readCoordOffset (sign-bit complement == 0 → read another group and combine) and the longitude "extra bit" precision. The naive decoder emitted a fixed large jump on escape, producing occasional wild vertices (spikes / triangular shards in polygons).
0.0.8 #
- Add
GarminImg.polygonColors: authentic per-type polygon fill colors parsed from the map's embeddedGARMIN TYPstyle subfile (header layout validated against Locus' TypFileHandler; polygon index at header+0x47). Background ("definition area", pure black) types are omitted so they aren't filled.
0.0.7 #
- Fix a critical RGN object-stride off-by-one: the polyline/polygon length byte
counts bitstream DATA bytes only (the leading info byte is separate), so the
next object starts at
bs + blen + 1. The old code stopped after the first object of every subdivision, discarding ~95% of all line/polygon geometry. Contour/area counts now increase ~20x. Adds a regression test.
0.0.1 #
- Initial skeleton: IMG container + GMP sub-maps, TRE (bounds, map levels, subdivisions), and polyline first-point decode. Validated against a real NT/GMP topo sample.
0.0.2 #
- Full polyline bitstream decode (all vertices), per-level subdivision walk with bits-per-coord, sanity-terminated chunk iteration. Decodes topo contour lines. Added example/img2geojson.dart. Validated against a real ~294MB topo.
0.0.3 #
- Polygons (area fills) + points/POIs decoding (same RGN bitstream / point layout). example/img2geojson.dart now emits Point/LineString/Polygon. Tests cover all three feature kinds against the real sample.
0.0.4 #
- LBL labels: POI/feature names and contour elevation labels. Supports 8-bit
(coding 9) and 6-bit (coding 6) label encodings. Features now carry
label.
0.0.5 #
- Streaming reads: ByteSource abstraction with a file-backed, block-cached source (FileByteSource) so large maps are not loaded into RAM. GarminImg.open now streams; GarminImg.fromBytes stays in-memory. maps are scanned once/cached. Added close(). All decode tests pass via the streaming path.
0.0.6 #
- featuresInBounds(query, {onlyBpc}): decode only subdivisions overlapping a viewport (optionally a single map level), for fast on-device rendering. Per-subdivision decoders; subdivision bbox from center + width/height.