@truelies/osm-dybuf 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +9 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -25,7 +25,7 @@ Current frontend-facing schema notes:
25
25
  - `place_label` remains in schema IDs for compatibility, but current exports no longer emit place-name labels to the frontend.
26
26
  - `label` main feature ID is now reserved for future overlay labels; `sub_id` is intended to carry `label kind` (`worship`, `station`, `custom`, etc.).
27
27
  - Current exporter-oriented subtypes are `label_worship` and `label_station`, both derived from existing `building` tasks. Consumers should group all future `label_*` subtypes by `unpackFeatureId(featureId).mainKey === "label"` if they want a single overlay layer.
28
- - Breaking change in `0.4.0`: `GridFeature.featureId` is numeric. Consumers should map it with `ID_TO_FEATURE_KIND[String(featureId)]` or `unpackFeatureId(featureId)` when string/debug output is needed.
28
+ - Breaking change in `0.4.x`: `GridFeature.featureId` is numeric. Consumers should map it with `ID_TO_FEATURE_KIND[String(featureId)]` or `unpackFeatureId(featureId)` when string/debug output is needed.
29
29
  - `road_express` covers motorway corridors plus `trunk` ways tagged with `motorroad=yes` (for example many Taiwan expressway mainlines).
30
30
  - `water_wetland` separates marsh / bog / fen / wetland polygons from deeper open water.
31
31
  - Current project max level is `13`; newer exports no longer emit `lv14~16`.
@@ -42,6 +42,7 @@ import { parseOsmDybuf } from "@truelies/osm-dybuf";
42
42
  import {
43
43
  FEATURE_KIND_IDS,
44
44
  ID_TO_FEATURE_KIND,
45
+ MAIN_FEATURE_IDS,
45
46
  unpackFeatureId,
46
47
  REGION_NUMERIC_CODES,
47
48
  } from "@truelies/osm-dybuf/schema_ids";
@@ -55,6 +56,7 @@ if (parsed.format === "flat_v1") {
55
56
  console.log(parsed.features[0].featureId); // numeric feature id
56
57
  console.log(ID_TO_FEATURE_KIND[String(parsed.features[0].featureId)]);
57
58
  console.log(unpackFeatureId(parsed.features[0].featureId));
59
+ console.log((parsed.features[0].featureId & 0x3f) === MAIN_FEATURE_IDS.label);
58
60
  } else if (parsed.format === "v2_indexed") {
59
61
  console.log(parsed.entries.length);
60
62
  } else {
@@ -76,6 +78,11 @@ if (parsed.format === "flat_v1") {
76
78
  --level 8 --londex 213 --latdex 161 --limit 5
77
79
  ```
78
80
 
81
+ Feature ID usage notes:
82
+ - Use `FEATURE_KIND_IDS.*` for exact feature comparison, for example `featureId === FEATURE_KIND_IDS.waterbody`.
83
+ - Use `MAIN_FEATURE_IDS.*` with `featureId & 0x3f` when you want to group all subtypes under the same main feature, for example `(featureId & 0x3f) === MAIN_FEATURE_IDS.label`.
84
+ - Use `unpackFeatureId(featureId)` for debug output or subtype-aware logic where readability matters more than raw hot-path comparisons.
85
+
79
86
  ### Grid helpers (grid_index)
80
87
 
81
88
  `grid_index.mjs` exposes Gridex helpers (integers, pole triangles) aligned with the exporter:
@@ -132,4 +139,4 @@ Unit test example (`tests/grid_index.test.mjs`) covers:
132
139
  - `region_numeric_codes.json`: latest region ID table (generated via `scripts/dump_region_codes.py`)
133
140
  - `inspect_dybuf.mjs`: CLI tool that uses the package locally
134
141
 
135
- When schema IDs or DyBuf layouts change in the exporter, remember to bump the version here and re-publish/install so frontends and tools stay in sync. Version `0.4.0` aligns the package with the current `lv0~13` export range, the current frontend feature set (`water_wetland`, `building`, no exported `place_label`), and the numeric `featureId` parser contract.
142
+ When schema IDs or DyBuf layouts change in the exporter, remember to bump the version here and re-publish/install so frontends and tools stay in sync. Version `0.4.1` aligns the package with the current `lv0~13` export range, the current frontend feature set (`water_wetland`, `building`, derived `label_*`, no exported `place_label`), and the numeric `featureId` parser contract.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truelies/osm-dybuf",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Gridex OSM DyBuf parser and schema utilities",
5
5
  "type": "module",
6
6
  "main": "./osm_dybuf.mjs",