Skip to content

Manage orienteering courses data with Javascript/Typescript

License

Notifications You must be signed in to change notification settings

orienteering-js/course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Course

Parse and manage orienteering courses data with Javascript/Typescript

Installation

Deno

deno add @orienteering-js/course

Npm

npx jsr add @orienteering-js/course

Yarn

yarn dlx jsr add @orienteering-js/course

Pnpm

pnpm dlx jsr add @orienteering-js/course

Bun

bunx jsr add @orienteering-js/course

Usage

import {
  parseIOFXML3CourseExport,
  parseGPXRoutechoicesOCADExport,
} from "@orienteering-js/course";
import { readFileSync } from "node:fs";

const courseFile = readFileSync("course.xml");
const routechoicesFile = readFileSync("routechoices.gpx");

const parser = new DOMParser();

const courseDocument = parser.parseFromString(courseFile, "text/xml");
const [controls, legs] = parseIOFXML3CourseExport(courseDocument, 0);

const routechoicesDocument = parser.parseFromString(
  routechoicesFile,
  "text/xml"
);
const legsWithRoutechoices = parseGPXRoutechoicesOCADExport(
  routechoicesDocument,
  legs
);

legsWithRoutechoices.forEach((leg) => {
  console.log(leg.routechoices);
});

About

Manage orienteering courses data with Javascript/Typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published