npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kilcekru/dcs-coordinates

v2.0.0

Published

Convert coordinates between dcs and lat/long

Downloads

50

Readme

dcs-coordinates

Convert coordinates between DCS internal coordinates and Latitude / Longitude

Typings and ts-doc are included.
This package is ESM only.

Installation

npm install @kilcekru/dcs-coordinates

Usage

LOtoLL

import { LOtoLL } from "@kilcekru/dcs-coordinates";

// convert coordinates of airport Senaki-Kolkhi
const point = LOtoLL({ theatre: "Caucasus", x: -281_782, z: 647_279 });

console.log(point);
// { lat: 42.24084, lng: 42.04801 }

LLtoLO

import { LLtoLO } from "@kilcekru/dcs-coordinates";

// convert coordinates of airport Senaki-Kolkhi
const point = LLtoLO({ theatre: "Caucasus", lat: 42.24084, lng: 42.04801 });

console.log(point);
// { x: -281_782, z: 647_279 }

API

LOtoLL

LOtoLL({theatre: Theatre, x: number, z: number}): {lat: number, lng: number};
type Theatre = "Caucasus" | "Normandy" | "PersianGulf" | "Sinai" | "SouthAtlantic" | "Syria";

Converts a point from DCS coordinates to Latitude / Longitude (decimal).
The result is not perfect, see Accuracy

LLtoLO

LLtoLO({theatre: Theatre, lat: number, lng: number}): {x: number, z: number};
type Theatre = "Caucasus" | "Normandy" | "PersianGulf" | "Sinai" | "SouthAtlantic" | "Syria";

Converts a point from Latitude / Longitude (decimal) to DCS coordinates.
The result is not perfect, see Accuracy

decToDms

decToDms(dec: number): DMS;
interface DMS {
	deg: number;
	min: number;
	sec: number;
}

Converts Latitude or Longitude from a decimal value to degrees, minutes, seconds.

dmsToDec

dmsToDec(dms: DMS): number;
interface DMS {
	deg: number;
	min: number;
	sec: number;
}

Converts Latitude or Longitude from degrees, minutes, seconds to a decimal value.

How it works

Method

I do not know the exact way, Lat/Lng is mapped to internal coordinates in DCS.

Because of this, a grid of coordinate points is extracted from each DCS theatre.
The grid does not cover the whole theatre, but all airports are included.
Points outside the grid can not be converted, trying so will throw an Error.

To convert a point the correct grid cell is selected and the result is interpolated from the cell corners.
This leads to inaccuracy, see next chapter.

Accuracy

Because bilinear interpolation is used to convert points results will be not perfect.
The deviation should be less than 10 meters for any given point.

Also LOtoLL and LLtoLO use different lookup grids. If a point is converted from one coordinate system to the other and back it will not be exact.
The deviation for this is less than 5 meters for all theatres.

Supported Theatres

Currently 6 theatres are supported:

  • Caucasus
  • Normandy
  • Persian Gulf
  • Sinai
  • South Atlantic
  • Syria

More theatres might be covered in the future.

License

Licensed under MIT.

Changelog

  • v2.0.0

    • renamed argument map to theatre
    • added export for types and schemas
  • v1.0.0

    • added sinai
    • increased boundaries for all maps
  • v0.1.0

    • Initial Release