@geodetic-lse/geodesy
v1.0.1
Published
Geodesy library for Geodetic LSE
Readme
@geodetic-lse/geodesy
Geodesy tools for least squares adjustment of surveying networks. Currently supports levelling networks (1D height adjustment).
Built on top of @geodetic-lse/core.
Installation
npm install @geodetic-lse/geodesyQuick start
import { loadLevellingNetwork, adjustLevellingNetwork } from '@geodetic-lse/geodesy'
const input = {
network: {
name: 'My levelling network',
points: [
{ id: 'A', height: 100.0, is_fixed: true },
{ id: 'B', height: 0, is_fixed: false },
{ id: 'C', height: 0, is_fixed: false },
],
observations: [
{ station: 'A', target: 'B', type: 'delta_height', value: 5.123, sigma: 1.0 },
{ station: 'B', target: 'C', type: 'delta_height', value: 3.456, sigma: 1.0 },
{ station: 'A', target: 'C', type: 'delta_height', value: 8.58, sigma: 1.0 },
],
parameters: {
type_computation: 'constrained',
sigma_0: 1.0,
},
},
}
const network = loadLevellingNetwork(input)
const result = adjustLevellingNetwork(network)
console.log('Redundancy:', result.redundancy)
console.log('s0 (a posteriori):', result.s0.toFixed(4))
console.table(result.adjustedPoints)
console.table(result.residuals)Input format
The input is a JSON object with a network key:
{
"network": {
"name": "Network name",
"source": "Data source",
"description": "Description",
"crsVertical": "IGN69",
"points": [...],
"observations": [...],
"parameters": {...}
}
}Points
| Field | Type | Required | Description |
| ---------- | --------- | -------- | ------------------------------------------------------------------- |
| id | string | yes | Unique point identifier |
| height | number | yes | Height in metres (initial approximation for unknowns) |
| is_fixed | boolean | yes | Whether the point is held fixed |
| sigma | number | no | Precision in mm — required for fixed points in free-adjusted mode |
Observations
Only delta_height observations are currently supported.
| Field | Type | Required | Description |
| --------- | -------- | -------- | ------------------------------------ |
| station | string | yes | Origin point ID |
| target | string | yes | Target point ID |
| type | string | yes | Must be "delta_height" |
| value | number | yes | Observed height difference in metres |
| sigma | number | yes | Observation precision in mm |
Parameters
| Field | Type | Default | Description |
| ------------------ | -------- | --------------- | ------------------------------------------------------------- |
| sigma_0 | number | 1.0 | A priori reference standard deviation |
| type_computation | string | "constrained" | Adjustment mode — see Computation modes |
Computation modes
| Mode | Description |
| --------------- | ------------------------------------------------------------------------------------- |
| constrained | Fixed points define a rigid reference frame (default) |
| free | One fixed point defines the datum; others are adjusted freely |
| free-adjusted | Fixed point heights are used as weighted pseudo-observations; all points are unknowns |
In
free-adjustedmode, each fixed point must have asigmavalue defined.
API
loadLevellingNetwork(input)
Parses and validates a raw input object. Throws descriptive errors on invalid data.
Returns a NetWork object ready for adjustment.
adjustLevellingNetwork(network)
Performs the least squares adjustment.
Returns a LevellingAdjustmentResult:
| Field | Type | Description |
| ---------------- | ----------------------- | ---------------------------------------------------- |
| adjustedPoints | AdjustedPoint[] | Adjusted heights with corrections and sigmas |
| residuals | ObservationResidual[] | Residuals and reliability indicators per observation |
| s0 | number | A posteriori standard deviation |
| sigma0 | number | A priori standard deviation |
| redundancy | number | Degrees of freedom |
| Kll | Matrix | Variance-covariance matrix of observations |
| Qll | Matrix | Weight coefficient matrix |
AdjustedPoint
| Field | Type | Description |
| ------------ | --------- | -------------------------------- |
| id | string | Point identifier |
| height | number | Adjusted height [m] |
| correction | number | Applied correction [m] |
| sigma | number | Standard deviation [mm] |
| is_fixed | boolean | Whether the point was held fixed |
ObservationResidual
| Field | Type | Description |
| ---------- | -------- | ---------------------------------------------------- |
| station | string | Origin point |
| target | string | Target point |
| observed | number | Observed height difference [m] |
| computed | number | Computed height difference from adjusted heights [m] |
| residual | number | Residual v [mm] |
| sigma | number | Standard deviation of residual [mm] |
| wi | number | Normalized residual — Baarda's test statistic |
| zi | number | Local redundancy number [%] |
| gi | number | Estimated gross error [mm] |
