Skip to content

Commit

Permalink
basic datum
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Oct 18, 2024
1 parent 345367a commit 49cef87
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/shared/datum.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { assert } from 'chai';

import qPROJ from 'proj.js';
import type * as PROJ from 'proj.js';

describe('Datum with automatic import', () => {
let PROJ: Awaited<typeof qPROJ>;

let dbContext: PROJ.DatabaseContext;
let authFactory: PROJ.AuthorityFactory;
let authFactoryEPSG: PROJ.AuthorityFactory;
let crs: PROJ.CRS;
let geoCRS: PROJ.GeographicCRS;
let datum: PROJ.GeodeticReferenceFrame;

before('init', async () => {
PROJ = await qPROJ;
dbContext = PROJ.DatabaseContext.create();
authFactory = PROJ.AuthorityFactory.create(dbContext, 'string');
authFactoryEPSG = PROJ.AuthorityFactory.create(dbContext, 'EPSG');
crs = PROJ.createFromUserInput('+proj=longlat +ellps=GRS80 +pm=paris +geoid_crs=WGS84 +type=crs', dbContext) as PROJ.CRS;
geoCRS = crs.extractGeographicCRS();
datum = geoCRS.datum();
});

it('Datum', () => {
assert.instanceOf(datum, PROJ.Datum);
});

it('Ellipsoid', () => {
const ellps = geoCRS.ellipsoid();
assert.instanceOf(ellps, PROJ.Ellipsoid);
assert.isNumber(ellps.getEPSGCode());
assert.instanceOf(ellps.semiMajorAxis(), PROJ.Length);
assert.instanceOf(ellps.inverseFlattening(), PROJ.Scale);
assert.isNumber(ellps.squaredEccentricity());
assert.isString(ellps.celestialBody());
})
});

0 comments on commit 49cef87

Please sign in to comment.