@tilda-geo/bicycle-infrastructure
v0.1.2
Published
TypeScript port of TILDA's LUA bicycle-infrastructure processing (category + surface/protection/oneway derivations). Runs on plain OSM tag objects (e.g. live Overpass data).
Maintainers
Readme
@tilda-geo/bicycle-infrastructure
Role: the public TypeScript library (ESM-only). Given plain OSM tags (e.g. from Overpass), it produces the same bicycle-infrastructure features TILDA’s LUA pipeline would — so QA tools and apps can classify live data without running osm2pgsql.
Part of the tilda-schemas monorepo. Schemas (vocabularies + fixtures) live under schemas/; this package implements them.
npm install @tilda-geo/bicycle-infrastructureWhat it does
- Takes one OSM way’s tags (
Record<string, string>). - Applies the same transforms as TILDA LUA (lifecycle, side splitting for
cycleway:left/right/ sidewalks, sanitizers). - Returns 1..N features (centerline
selfplus transformedleft/rightsides), each with:category—Radinfrastrukturkategorie(primary focus; seeschemas/bicycle-infrastructure-category)- plus surface, smoothness, oneway, separation / buffer / marking, traffic_mode, traffic_sign, surface_color, width
Disallowed sanitizer values become null, matching TILDA’s GeoJSON export.
import { processBikelanes } from '@tilda-geo/bicycle-infrastructure'
const features = processBikelanes({
highway: 'secondary',
'cycleway:right': 'lane',
'cycleway:right:lane': 'exclusive',
surface: 'asphalt',
})
// → [{ _side: 'right', _prefix: 'cycleway', category: 'cyclewayOnHighway_exclusive',
// oneway: 'implicit_yes', surface: 'asphalt', ... }, ...]How it relates to the rest of the monorepo
| Piece | Relationship |
| --- | --- |
| schemas/bicycle-infrastructure-category | Source of truth for allowed category values + fixtures |
| schemas/bicycle-infrastructure-attributes | Draft vocabularies for non-category fields (fixtures used in tests) |
| bicycle-infrastructure-reconciliation | Internal tooling that proves this library ≡ TILDA LUA on a Berlin corpus |
Map to TILDA LUA
Ported module-for-module from tilda-geo → processing/topics/roads_bikelanes:
| This package | LUA |
| --- | --- |
| transform/prepare-tags.ts | helper/transform_tags/* |
| transform/transformations.ts | bikelanes/transformations.lua |
| categories/* | bikelanes/bikelane_categories.lua (+ decision view, sidepath) |
| sanitize/*, derive/* | helper/sanitize_*, derive_* |
| index.ts → processBikelanes | bikelanes/bikelanes.lua |
Develop / test
From the monorepo root:
bun install
bun run build
bun run --filter '@tilda-geo/bicycle-infrastructure' test
bun run check-exportstest/spec.test.ts— conformance againstschemas/**/fixtures(viatest/load-spec.ts)test/categories.smoke.test.ts— cases ported from LUA__tests__
Berlin corpus check (category agreement ~100%): see the internal reconciliation package.
Releases use changesets — see the root README Release section (manual publish, same as the smoothness packages).
Known limitations
_adjoining/_isolated/_adjoiningOrIsolateduse the raw OSMis_sidepathtag (same as LUA categorization). TILDA’s_is_sidepathCSV estimate is export-only and does not affect category.highway=constructionlifecycle is handled; the geometry crossing-length filter (>100 m) is skipped when_lengthis absent (typical for live Overpass tags).
