Schema-driven parser for Dutch BRO (Basisregistratie Ondergrond) geotechnical XML data
npm install @bedrock-engineer/bro-xml-parserParser for Dutch BRO (Basisregistratie Ondergrond) XML data, focussing on geotechnical and geological data.
- CPT (Cone Penetration Test) - 41 metadata fields + measurements
- BHR-GT (Geotechnical Borehole) - soil layers + optional lab analysis
- BHR-G (Geological Borehole) - NEN5104 soil classification
Zero dependencies in browser (uses native DOMParser). Full TypeScript support.
``bash
npm install @bedrock-engineer/bro-xml
Usage
`typescript
// Browser
import { BROParser, XMLAdapter } from "@bedrock-engineer/bro-xml";// Node.js
import { BROParser, XMLAdapter } from "@bedrock-engineer/bro-xml/node";
const parser = new BROParser(new XMLAdapter());
// Auto-detect file type
const data = parser.parse(xmlText);
console.log(data.meta.dataType); // 'CPT' | 'BHR-GT' | 'BHR-G'
// Or parse specific types
const cpt = parser.parseCPT(xmlText);
const bore = parser.parseBHRGT(xmlText); // BHR-GT
const bhrg = parser.parseBHRG(xmlText); // BHR-G
`Custom Schemas
Extract only the fields you need:
`typescript
import {
BROParser,
XMLAdapter,
resolvers,
} from "@bedrock-engineer/bro-xml/node";const parser = new BROParser(new XMLAdapter());
const mySchema = {
id: { xpath: "brocom:broId" },
depth: { xpath: ".//cptcommon:finalDepth", resolver: resolvers.parseFloat },
location: {
xpath: "./dscpt:deliveredLocation/cptcommon:location",
resolver: resolvers.parseGMLLocation,
},
};
const result = parser.parseCustom(xmlText, mySchema, "CPT");
// { id: "CPT000000099543", depth: 25.5, location: { x: 155000, y: 463000, epsg: "28992" } }
`API
| Method | Returns | Description |
| --------------------------------- | ----------- | -------------------------- |
|
parse(xml) | BROData | Auto-detect type and parse |
| parseCPT(xml) | CPTData | Parse CPT file |
| parseBHRGT(xml) | BHRGTData | Parse BHR-GT file |
| parseBHRG(xml) | BHRGData | Parse BHR-G file |
| parseCustom(xml, schema, type?) | T | Parse with custom schema |src/types/index.ts for full type definitions.Supported Schemas
| Type | Schema Version | Link |
| ------ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CPT |
dscpt/1.1 | BRO CPT docs |
| BHR-GT | dsbhr-gt/2.1 | BRO BHR-GT docs |
| BHR-G | dsbhrg/3.1 | BRO BHR-G docs |Reference Codes
Exported lookup tables for BRO domain codes (soil names, colors, procedures, etc.) are auto-generated from the BRO reference codes API. Run
codegen:reference-codes` to regenerate.Apache 2.0 - Jules Blom at Bedrock.engineer