Parchment Docs
Barrelman

Indoor maps

How Barrelman builds floor plans from OpenStreetMap indoor tagging and serves them as the indoor tile bundle.

Barrelman turns OpenStreetMap's Simple Indoor Tagging into floor plans and serves them as vector tiles. Parchment draws them with a floor picker; see Indoor maps for what users see.

Everything is built in one materialized view, indoor_features (import/create-indoor-views.sql), with one row per feature per level it stands on. A client shows a floor with a single level == n filter.


Tiles

Two Martin sources read views over indoor_features, and the indoor bundle (src/config/tile-bundles.ts) serves both in one tile:

GET /tiles/indoor/{z}/{x}/{y}

indoor_venues (zoom 15–17)

One outline per venue: a terminal, a mall, a station's concourses. It arrives a zoom before the plans, so a client knows a floor plan is there before it draws one.

PropertyDescription
venueVenue id
nameThe airport's, when the venue spans several named terminals; else its biggest named building's, a car park only failing all others; else the nearest station's
levelsIts levels, ;-separated: -1;0;1
level_namesSignage names by level: -1=B1;0=G
default_levelThe level it opens on
buildings;-separated ids of the building outlines it stands in, for a client to hide while the plan shows

indoor_map (zoom 16–17)

The plans themselves. Every row carries venue and default_level, so a style can show one venue at a chosen level and every other at its own default.

PropertyDescription
venue, level, default_levelThe venue, the level this row is drawn on, and the venue's default
kindfloor, wall, area, line, flight or poi
classWhat the feature is (below)
subclassDetail for styling: a room's use, an escalator's conveying, a door's entrance value, a POI's tag value, security for a screening checkpoint, or jet_bridge
name, refFrom the OSM feature; ref carries a gate's number
idThe OSM feature's place id
width, length, bearingOn flight rows: the flight's width and length in metres, and the bearing it climbs, in degrees
KindRowsClasses
floorEach level's walkable outline. Above ground it also covers the venue's buildings, so a sparsely mapped floor still reads as the building—
wallRoom outlines (not stairwells or lift shafts), mapped walls and the floor's edge, merged per level and buffered to a drawn thickness (60 cm inside, 1 m outside), with openings cut at doors—
areaRooms, areas, corridors, platforms, columns, stairs, lift shafts and jet bridgesroom, area, corridor, level, column, platform, stairs, elevator, wall
lineSteps, escalators, indoor footways and platforms mapped as lines. A flight has none on the level it climbs fromsteps, escalator, corridor, platform
flightA point at the middle of each stair or escalator that climbs between levels, on the lower levelsteps, escalator
poiShops, amenities, gates, doors, lifts, a label point for each named room, and a point at the middle of each flight of steps for its iconThe POI's key (shop, amenity, aeroway, railway, …), door, elevator, steps, escalator, room

Door openings use the door's width, defaulting to 0.9 m and clamped between 0.7 m and 4 m.

Flights. A stair or escalator line on more than one level, with incline=up or incline=down, becomes a flight on its lower level, climbing in the direction incline gives. Its length runs from end to end of the line, and it is 1.5 m wide (1.2 m for an escalator) unless width says otherwise. A down flight within 6 m of a parallel up one climbs the same way, since down is often tagged for where an escalator carries you rather than how its way slopes. Clients draw the flight as a model, rising a storey over its length.

Jet bridges. An aeroway=jet_bridge line within about 50 m of a venue joins the nearest one as a corridor (class=corridor, subclass=jet_bridge), 3 m wide unless width says otherwise (clamped to 2–6 m). It stands on its level, or on the venue's default level, and is part of that level's floor and walls.


Which OSM features are read

A feature is considered when it has level, repeat_on or indoor, is a platform (railway=platform or public_transport=platform), or is an aeroway=gate. Anything tagged indoor=no, and building outlines without indoor, are left out.

TagsBecomes
indoor=room / area / corridor / level / columnAn area of that class. room=stairs or stairs=yes is stairs; highway=elevator or room=elevator is a lift shaft
indoor=wall (area or line)A wall
highway=stepsSteps, or an escalator with a conveying value other than no
highway=footway / path / pedestrian with indoor, or highway=corridorAn indoor footway
PlatformsOnly indoors or underground: with indoor, a negative level or layer, location=underground or tunnel. An open-air platform is the basemap's
shop, amenity, tourism, office, healthcare, craft, leisure, aeroway=gate, station entrances, ticket validatorsA POI. A gate also tagged as a door counts as a gate
aeroway=jet_bridge (line)A jet bridge, with or without indoor tags
door, entrance, indoor=doorA door, and an opening in the wall it sits on
amenity=security_control, police=checkpoint, room=security_check, aeroway=security_checkpointDrawn as one screening zone (subclass=security)
level:refThe level's name on the signs

Levels

A feature's levels are its level plus any repeat_on. Lists (0;1), ranges (0-2, -4--2), decimals (-0.5) and any order are understood. Unparseable parts and anything past 200 floors either way are skipped rather than failing the feature, and a feature is drawn on at most 64 levels.

Where level is missing:

  • A platform or indoor feature with a layer from -1 to -9 takes that as its level, one storey per layer.
  • Otherwise an indoor area, corridor, wall, column or level outline goes on level 0.
  • A gate goes on its venue's default level.
  • Anything else is left out, even with repeat_on.

How venues are derived

Clustering. Indoor shapes (not points) within about 25 m of each other form one venue. Clustering runs per cell of a quarter-degree grid, so a venue straddling a grid line splits in two. A cluster becomes a venue only with at least three rooms, areas, corridors, platforms or level outlines: a lone indoor passage is not a building to step into. The venue's outline is the convex hull of its shapes.

Points. A shop, door or other point joins the venue whose outline contains it. Inside two, it joins the smaller, so it is drawn once.

Levels. A venue's levels are those its rooms, areas, corridors, platforms and level outlines stand on. Each is named by the commonest level:ref (or indoor=level name) among the single-level shapes on it, up to 12 characters.

Default level. For an airport, the level most of its gates are on. Otherwise level 0 if the venue has one, else its busiest level, so a station that is entirely below ground opens on its concourse.

Buildings. The above-ground building and building-part outlines the venue stands in, for a client to clear while the plan shows:

  • outlines whose footprint is more than 30% covered by the venue's rooms at ground level or above;
  • parts, roofs and annexes at least 40% inside those or the rooms;
  • building=roof canopies touching them.

The venue's own outline is not used here: under a station it can run beneath whole blocks of towers. Underground outlines (location=underground) are never cleared.


Building and refreshing

The view stores its rows rather than computing them per tile, because floors and walls union whole levels.

  • Creation. The API creates the view (empty) at startup, and fills it in the background if it has never been populated. scripts/import-osm.sh creates and fills it after an import.

  • Refresh. scripts/update-osm.sh refreshes it after every OSM update. To refresh by hand, run the Refresh Indoor Maps task in the admin console, or:

    scripts/refresh-view.sh indoor_features

    A populated view refreshes concurrently, so tiles keep serving the old rows until the new ones are ready.

  • Index. import/create-detail-indexes.sql builds the partial indexes geo_places_indoor_geom_idx and geo_places_jet_bridge_geom_idx concurrently. Without the first, the refresh scans all of geo_places; on a New York import it took 169 s without the index and about 4 s with it.

  • Schema changes. The view carries a version comment (v10). A changed query needs it bumped: the next run then drops and recreates the view.

A deployment with its own martin-config.yaml needs the indoor_venues, indoor_map and fixtures entries added, including height on indoor_map. Start the API first so the views exist: Martin exits on a source whose table is missing.


Fixtures

Outside floor plans, the fixtures view (import/create-detail-views.sql) holds what a person finds their way by at street level. It is served as the fixtures source in the detail bundle, zoom 16–17, with these properties:

PropertyDescription
kindstation_entrance (railway=subway_entrance or train_station_entrance), elevator (highway=elevator) or entrance (entrance=main or yes)
refThe entrance's ref
idThe OSM feature's place id

Only points are read, and anything indoor or underground (indoor, location=indoor or underground) or private (access=private or no) is left out: indoor ones belong to floor plans. The view is refreshed with indoor_features: after imports and OSM updates, by the Refresh Fixtures console task, or with scripts/refresh-view.sh fixtures.


How Parchment draws it

Parchment's MapLibre style adds the indoor source and drives it through style state keys, so changing floors rebuilds no filters:

StateHolds
indoorVenueThe venue the floor picker serves, 0 for none
indoorLevelThe level shown in that venue; 1000 shows its outside
indoorBuildings;id; list of building ids hidden from the 3D buildings layer
indoorPlacesBasemap ids of the shops and gates a showing floor plan labels itself, hidden from the basemap's labels
indoorFixturesIds of the doors, lifts and station entrances a showing floor plan signs, hidden from the fixtures layer

Every other venue shows its default_level, or its outside when that level is below ground. A venue counts as showing when it is on a floor rather than its outside. Fixtures are drawn by web/src/lib/map-style/fixture-layers.ts: station entrances and lifts from zoom 17, building entrances from zoom 18. The indoor layers live in web/src/lib/map-style/indoor-layers.ts, the picker logic in web/src/lib/indoor/indoor-venue.ts and web/src/services/map/indoor.service.ts.