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

@gchoqueux/geographic

v2.45.7

Published

Geodesy

Downloads

1,226

Readme

iTowns Geographic

The geographic package provides utilities for handling coordinates, ellipsoids, extents and rotations across different coordinate systems.

  • Coordinates : A Coordinates object (geodetic datum), defined by a [crs] and three values.
  • [Coordinates stars] : get sun position, azimuth, ascention, ecliptic longitude and declination from date.
  • Coordinate Reference System : This module provides basic methods to manipulate a CRS (as a string). to explore available coordinates systems and use their proj4js definition to define them in itowns with proj4.defs(crs, proj4def).
  • Ellipsoid : A representation of an ellipsoid and useful computation methods (geodetic normal, etc.)
  • Ellipsoid Size: The length of the earth ellispoid semi-axes.
  • Extent : Extent is geographical bounding rectangle defined by a crs and 4 limits: west, east, south and north .
  • OrientationUtils : utilities to compute a rotation quaternion from various rotation conventions, including between different crs.

Install

npm install --save @itowns/geographic

Getting started

import { Coordinates, Extent, CRS } from '@itowns/geographic';

const coordinates = new Coordinates('EPSG:4326', 88.002445, 50.336522, 120.32201);
const extent = new Extent('EPSG:4326', 88.002445, 50.336522, 22.021, 50.302548);

// change projection system to pseudo mercator

coordinates.as('EPSG:3857');
extent.as('EPSG:3857');

// change projection system to EPSG:2154

// defs EPSG:2154 crs (visit epsg.io to get the proj4js definition of a crs)
CRS.defs('EPSG:2154','+proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs');

coordinates.as('EPSG:2154');

OrientationUtils example

In geodesy, attitude refers to the orientation of a geodetic instrument or platform in three-dimensional space. It is defined by the angles that describe how an instrument or a vehicle (like a satellite or aircraft) is positioned relative to a reference coordinate system, typically the Earth's surface or a local tangent plane.

// Compute the rotation around the point of origin from a frame aligned with Lambert93 axes (epsg:2154),
// to the geocentric frame (epsg:4978)

quat_crs2crs = OrientationUtils.quaternionFromCRSToCRS("EPSG:2154", "EPSG:4978")(origin);

// Compute the rotation of a sensor platform defined by its attitude

const attitude = {
	// Rotation around the longitudinal axis of the object (front-to-back axis), tilting the object sideways.
	Roll: 0.0,
	// Rotation around the lateral axis (side-to-side axis), moving the nose or front up or down.
	Pitch: Math.PI * 0.2,
	// Rotation around the vertical axis (top-to-bottom axis), changing the direction the object is facing horizontally.
	Yaw: Math.PI * 0.5,
}

quat_attitude = OrientationUtils.quaternionFromAttitude(attitude);

// Compute the rotation from the sensor platform frame to the geocentric frame

quat = quat_crs2crs.multiply(quat_attitude);

Visit the iTowns documentation for more information.