Skip to content

TypeScript library for parsing GEF (Geotechnical Exchange Format) files. A common format for exchanging geotechnical data in the Netherlands and Belgium.

License

Notifications You must be signed in to change notification settings

bedrock-engineer/gef-parser-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@bedrock-engineer/gef-parser

npm version

A TypeScript library for parsing GEF (Geotechnical Exchange Format) files. GEF is the standard file format for exchanging geotechnical data in the Netherlands and Belgium, including Cone Penetration Test (CPT) measurements and borehole logs.

This parser handles the GEF format specification, coordinate transformations, and provides typed data structures for analysis and visualization. It uses the WebAssembly build of gef-file-to-map for initial tokenization, with all CSV parsing, header validation, and domain logic implemented in TypeScript using zod.

Try the live demo

Features

  • Parse GEF-CPT (Cone Penetration Test) files
  • Parse GEF-DISS (Dissipation Test) files
  • Parse GEF-BORE (Borehole) files with soil layers and specimens
  • Automatic GEF type detection
  • Support for Dutch (BRO/VOTB) and Belgian (DOV) extensions
  • Coordinate system conversion to WGS84
  • Depth correction for inclinometer data

GEF-SIEVE files are not supported.

Installation

npm install @bedrock-engineer/gef-parser

Usage

Basic Parsing

Parse a GEF file and automatically detect whether it's CPT or borehole data:

import { parseGefFile } from "@bedrock-engineer/gef-parser";

// From a browser file input
const fileInput = document.querySelector('input[type="file"]');

fileInput.addEventListener("change", async (e) => {
  const file = e.target.files[0];
  const gefData = await parseGefFile(file);

  switch (gefData.type) {
    case "CPT": {
      console.log("Cone resistance:", gefData.data.qc);
      console.log("Depth:", gefData.data.depth);
      console.log("Metadata:", gefData.metadata);
    }
    case "BORE": {
      gefData.data.forEach((layer) => {
        console.log(
          `${layer.soilCode} from ${layer.depthTop}m to ${layer.depthBottom}m`,
        );
      });
      console.log("Specimens:", gefData.specimens);
    }
    case "DISS": {
      console.log("Dissipation data:", gefData.data);
    }
  }
});

With Node.js reading GEF file from filesystem:

import { readFile } from "fs/promises";

const buffer = await readFile("path/to/file.gef");
const file = new File([buffer], "file.gef");
const gefData = await parseGefFile(file);

## API

### Main Functions

- `parseGefFile(file: File): Promise<GefData>` - Parse any GEF file
- `parseGefCptData()` - Parse CPT-specific data
- `processCptMetadata()` - Extract CPT metadata
- `parseGefBoreData()` - Parse borehole-specific data
- `processBoreMetadata()` - Extract borehole metadata
- `parseGefDissData()` - Parse DISS-specifc data

### Types

All types are exported from the main entry point:

```typescript
import type {
  GefData,
  GefCptData,
  GefBoreData,
  GefHeaders,
  ColumnInfo,
  GefDissData,
} from "@bedrock-engineer/gef-parser";

License

Apache-2.0

By Jules Blom at Bedrock.engineer

About

TypeScript library for parsing GEF (Geotechnical Exchange Format) files. A common format for exchanging geotechnical data in the Netherlands and Belgium.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors