ma_parcelle
Click a land parcel and the map cores it through six layers of French open data, with no account and no server.
- Stack
- React 19 · Vite · MapLibre
- Year
- 2026
- Repository
- github.com/Popoch39/ma_parcelle ↗
Anatomy
7 parts · only one countsPick a parcel
A click reads the parcel’s ID from the map already on screen, with no network call.
PciLayer()10
export function PciLayer() {11
const { line } = OVERLAY_COLORS[useColorScheme()]12
const select = useSelectionStore((state) => state.select)Hold on to one parcel
One parcel open at a time, known by its 14-character cadastral code.
SelectionState3
interface SelectionState {5
idu: string | null10
reframe: booleanLoad the parcel
Asks the IGN cadastre for the parcel’s shape and area, in a single request.
loadParcel()67
export async function loadParcel(fetch: Fetch, idu: string, { signal }: LoadOptions = {}): Promise<Parcel> {68
const parts = parseIdu(idu)69
if (!parts) throw new ParcelError('invalid-idu', idu)Start from the parcel
Every block starts from the cached parcel; if it is missing, they all fail together.
parcelBlockQuery()11
export const parcelBlockQuery = <Model>(queryClient: QueryClient, block: BlockId, idu: string, load: BlockLoader<Model>) =>12
queryOptions({13
queryKey: [block, idu],Query each source
The browser calls the public APIs with no server in between, 15 s at most per reply.
fetchBody()61
async function fetchBody<T>(62
fetch: Fetch,63
url: string,Stack the six blocks
Cadastre, planning, hazards, sales, building and DPE: each loads and fails on its own.
BLOCKS18
export const BLOCKS = [19
{ id: 'cadastre', Section: CadastreSection },20
{ id: 'planning', Section: PlanningSection },Write the summary
Sums up the blocks received, leaves out failed ones and flags those still loading.
assembleSummary()63
export function assembleSummary(blocks: readonly BlockState[]): Summary {64
return {65
facts: blocks.flatMap((block) => (block.status === 'success' ? block.data : [])),
Press and hold the column to drill through the strata · click the plate to run the survey againKeep your finger on the column to drill through the strata · tap the plate to run the survey again
Parts list
- 01 Parcel plate The engraved cadastral map. You pick a parcel by touching it: its ID (IDU) is read from the tile already on screen, with no network call. Code: src/map/layers/PciLayer.tsx, lines 9–45 ↗
- 02 Surface casing One casing for one hole: the selection holds a single parcel at a time. Code: src/stores/selection-store.ts, lines 3–20 ↗
- 03 Cadastral crust The first layer to break through: the parcel named by its IDU, from which all the others start. Code: src/api/cadastre.ts, lines 63–74 ↗
- 04 Core barrel It carries the parcel, taken from the Cadastre cache, down into every stratum. If the crust breaks, it brings nothing back up. Code: src/queries/block.ts, lines 6–15 ↗
- 05 Diamond bit It bites into each source: a GET with a 15 s timeout and a typed error (HTTP, timeout, network, invalid JSON). Code: src/api/fetch-json.ts, lines 61–91 ↗
- 06 Stratum rings Six bolted rings, one per block, in the order of the report. Each one loads and fails on its own. Code: src/components/report/blocks.ts, lines 14–25 ↗
- 07 Borehole log The summary: it is written from whatever has come up. A lost stratum, or one still loading, leaves its line blank, and the indicator stays lit while any stratum is loading. Code: src/lib/summary/summary.ts, lines 59–68 ↗