Skip to content

navmap_tools: buildings from the Catastro / OpenStreetMap, and large NavMaps of a place - #45

Open
jmguerreroh wants to merge 2 commits into
EasyNavigation:rollingfrom
jmguerreroh:navmap-tools-buildings
Open

jmguerreroh wants to merge 2 commits into
EasyNavigation:rollingfrom
jmguerreroh:navmap-tools-buildings

Conversation

@jmguerreroh

@jmguerreroh jmguerreroh commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

navmap_tools: buildings from the Catastro / OpenStreetMap, and large NavMaps of a place

Branch base: rolling. Files: navmap_tools only (and its section of the README). Independent of
the navmap_core simplify PR; neither needs the other.

What it takes to get a NavMap of a real city: the ground from a DEM, without the buildings, at a
size the Python --navmap sampling cannot reach (2 x 2 km around the Puerta del Sol at 0.5 m is
16 M cells and 13.8 M NavCels).

navmap_gis_tool

  • --buildings {auto,catastro,osm} (geo/buildings.py): the footprints of the buildings, and
    every cell any part of a building is in left without ground (patios stay ground).
    • catastro: the Spanish Catastro's INSPIRE WFS (BU:BuildingPart with floors above the
      ground; underground parts are left out), asked by tiles of 800 m. A tile the service keeps
      failing on is retried with backoff and asked in four (twice); where it still answers an error
      page for the building parts (it happens in some places of Madrid), the whole buildings
      (BU:Building) are asked instead: the footprints, without the floors.
    • osm: OpenStreetMap through Overpass (building=*, except no, roof and carport, which
      are no obstacle at ground level).
    • auto: the Catastro in Spain, OpenStreetMap elsewhere or where the Catastro has none.
    • Every answer is cached on disk (--cache-dir).
  • --navmap-out FILE (geo/dem_navmap.py): the local height grid as a NavMap, two NavCels per
    cell with ground, without the cells that have none (--buildings, --dem-holes-mesh) or are
    steeper than --max-slope-deg; vertex colours with --dem-imagery. Vectorised: the 13.8 M
    NavCels above take 6 min (most of it the download) and 3 GB.
  • --dem-holes-mesh also works with --navmap-out.
  • --navmap-keep {X,Y|largest}: only the NavCels connected to a point (metres in the local
    frame of --center, e.g. where the robot starts; the nearest cell with ground is taken), or
    the largest connected part. A NavMap made from a terrain mesh with its buildings keeps their
    flat roofs as islands, cut off by the walls the slope limit leaves out; closed patios are
    islands too. In the area world of 500 x 500 m around the Puerta del Sol, the 2 289 parts
    (55 % of the area roofs) become the one the robot is on. Vectorised union-find on the grid:
    16 M cells in about 2 s.
ros2 run navmap_tools navmap_gis_tool --center 40.41690,-3.70350 --size 2000 --resolution 0.5 \
  --dem-source ign --buildings auto --navmap-out sol_0.5m.navmap

Tests

New tests for the footprints (cells inside a
building, its edges, its patios, footprints beyond the grid), the Catastro answer in the local
frame (underground parts left out), the OpenStreetMap fallback, the whole-buildings fallback, the
DEM-to-NavMap conversion (holes, slopes, colours, the connected parts against a flood fill, the
part at a point or the largest) and the CLI options (a roof left out by --navmap-keep). No network involved: the
answers are canned.

colcon test --packages-select navmap_tools on this branch: 595 tests (with the linters), no
failures.

…NavMaps of a place

navmap_gis_tool:
- --buildings {auto,catastro,osm}: downloads the footprints of the buildings (the Catastro
  INSPIRE WFS in Spain, by tiles, retried with backoff, split in four when the service keeps
  failing and, where it still fails on the building parts, asked for the whole buildings;
  OpenStreetMap through Overpass elsewhere or where the Catastro has none) and leaves without ground every
  cell any part of a building is in; patios stay ground. Answers are cached on disk.
- --navmap-out FILE: the local height grid as a NavMap, two NavCels per cell with ground,
  without the cells that have none (--buildings, --dem-holes-mesh) or are steeper than
  --max-slope-deg; vertex colours with --dem-imagery. Vectorised (tens of millions of cells),
  unlike --navmap, whose sampling loop is pure Python.
- --dem-holes-mesh now also works with --navmap-out.
… a point (or the largest)

A NavMap made from a terrain mesh with its buildings keeps their flat roofs as islands, cut off by
the walls the slope limit leaves out; closed patios are islands too. --navmap-keep X,Y keeps the
NavCels connected to that point (the nearest cell with ground), --navmap-keep largest the largest
part. The parts are found on the grid by a vectorised union-find (16 M cells in about 2 s).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant