@buildtheearth/projection
v1.0.2
Published
Multilanguage implementation of the BuildTheEarth projection
Readme
@BuildTheEarth/projection
Typescript implementation of the BuildTheEarth projection.
Usage
The package exports two functions, toGeo and fromGeo. You can find their usage below:
toGeo
Converts Minecraft x and z coordinates to geographical lat and lon pairs.
import { toGeo } from "@buildtheearth/projection";
// or: const minecraftCoordinates = {x: 4411832, z: -4736410};
const minecraftCoordinates = [4411832, -4736410];
// or: const geographicalCoordinates = toGeo(minecraftCoordinates, {returnObject: true});
const geographicalCoordinates = toGeo(minecraftCoordinates);
console.log(geographicalCoordinates); // [49.55843154291236, 22.810606562070433]
// {lat: 49.55843154291236, lon: 22.810606562070433}fromGeo
Converts geographical lat and lon coordinates to Minecraft x and z pairs.
import { fromGeo } from "@buildtheearth/projection";
// or: const geographicalCoordinates = {lat: 49.55843154291236, lon: 22.810606562070433};
const geographicalCoordinates = [49.55843154291236, 22.810606562070433];
// or: const minecraftCoordinates = toGeo(geographicalCoordinates, {returnObject: true});
const minecraftCoordinates = fromGeo(geographicalCoordinates);
console.log(minecraftCoordinates); //[4411832, -4736410]
// {x: 4411832, z: -4736410}Contribute
This package is part of a repository containing the implementation of the projection in different languages. If you want to contribute a new language, please read thru the specification.
