Skip to content

fix(search): pan + mark when opening a building by BAG number#252

Merged
yorickdewid merged 1 commit into
mainfrom
fix/searchbar-bag-number
Jun 7, 2026
Merged

fix(search): pan + mark when opening a building by BAG number#252
yorickdewid merged 1 commit into
mainfrom
fix/searchbar-bag-number

Conversation

@yorickdewid

Copy link
Copy Markdown
Contributor

Why

Closes part of Laixer/FunderMaps#986 — "the searchbar must support searching by BAG number." The BAG-direct path already resolved and opened the building, but the map never panned and no marker dropped. Since commit b5e51b4 ("the TS API geocoder no longer returns building coordinates"), the map only pans when mapCenterLatLon/mapMarkerLatLon are set explicitly at the source. The PDOK address path was fixed to do that (from PDOK's centroide_ll); the direct-BAG path was never given a coordinate source, so it opened the panel but left the map where it was. It also navigated by the raw typed id and threw away the lookup result.

What

  • Adapter / interface: surface building.latitude / building.longitude on the geolocation data (residence point preferred, building centroid fallback — see the paired API PR fix(geocoder): return building centroid from /building-info FunderMapsApi#71). Nothing else watches these fields, so the map-click flow is unaffected.
  • SearchBar: the BAG-direct branch (lookupBuildingopenBuilding) now mirrors the working address path — drops a marker + pans from the resolved coordinates, reflects the resolved address in the search box, and navigates by the canonical PAND id. mapCenterLatLon is set only after navigateToBuilding resolves, because the center change triggers a URL writeback in mapCenterRouting that would otherwise push the old route and cancel the navigation (same ordering as handleSelectBuilding).
  • Failed lookups return null and fall through to PDOK suggestions, unchanged.

Verification (E2E on the guest)

  • vue-tsc --noEmit clean; pnpm build green.
  • Ran the real adapter against the live local API for a bare 16-digit PAND, a bare NUMMERAANDUIDING, the full NL.IMBAG.PAND.* form, and a bogus id:
    • addressed building → coords from the residence point, address relabel applied;
    • residence-less rural PAND → coords from the centroid, empty street so the box is left as typed (no "," mislabel);
    • bogus id → API 400 → null → falls through to PDOK without crashing.

Depends on

Laixer/FunderMapsApi#71 for the centroid fields. The adapter degrades gracefully against an un-upgraded API (falls back to residence coords, i.e. today's behavior), so there's no hard deploy ordering.

🤖 Generated with Claude Code

Searching by BAG number resolved and opened the building, but the map
never moved and no marker dropped: the direct-BAG branch had no
coordinate source (the geocoder stopped returning building coordinates
on navigation, and the address path was the only one fixed to pan).

Surface the building footprint centroid (residence point preferred,
centroid fallback) through the geolocation adapter, and rework the
direct-BAG branch to mirror the address path: drop a marker + pan from
the resolved coordinates, reflect the resolved address in the box, and
navigate by the canonical PAND id. Center is set only after navigation
completes so the URL writeback doesn't cancel the route push.

Refs Laixer/FunderMaps#986

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yorickdewid yorickdewid merged commit d6337f1 into main Jun 7, 2026
4 checks passed
@yorickdewid yorickdewid deleted the fix/searchbar-bag-number branch June 7, 2026 13:51
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