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 🙏

© 2026 – Pkg Stats / Ryan Hefner

geolibri

v0.0.5

Published

Simple library to handle geo objects

Readme

geolibri

geolibri is a simple Node.js package that provides some geo features.

Using package

var geo = require('geolibri');

Available functions

  • deg2rad Conversion of degrees to radians.
  • rad2deg Radians to degrees conversion.
console.log(" 180° in radians = ",geo.deg2rad(180));
console.log(" 1 radian in degrees = ",geo.rad2deg(1));
  • point(...) Creates a point object defined by latitude and longitude.

Possible syntax:

    var P1 = geo.point(latitude, longitude);
    var P2 = geo.point({"latitude":lat , "longitude":lng});
    var P3 = geo.point({"lat":lat , "lng":lng});

We can also give latitude and longitude in radians using *._point(...) instead of .point(...).

It is also possible to initialize a point from another one:

    var P1 = geo.point({latitude:, longitude:});
    var P2 = geo.point(P1); // P2 is at the same position as P1

point() methods

  • .lat(), .lng(), .latlng() To get latitude, longitude or a {lat,lng} object.

  • ._lat(), ._lng(), , ._latlng() To get latitude or longitude in radians.

  • .N( dist ), .E( dist ), .S( dist ), .W( dist ) Returns a new point that is from a distance dist to the North, East, South or West. The distance dist is expressed in meters.

  • .O( dist ) Is an alias of .W( dist ) (for the french word Ouest).

  • move( dir, distance ) This function moves the current point into the indicated direction and the given distance (in meters). The change is applied to the current point and the returned value is the point itself, to chain functions.

    var P = geo.point(latitude, longitude);
    P.move('N' , 1000 ); // P is moved 1 km to the north
    P.move('E' , 1000 ); // P is then moved 1 km to the east
    P.move('S' , 2350 ).move('W' , 1500 ); // P is now moved 2.35 km to the south and 1.5 km to the west
  • .distance( point )

Gives the distance from a point to another one.

    var P = geo.point(lat1, lng1 );
    var Q = geo.point(lat2, lng2 );

    console.log("Distance from P to Q : ",P.distance(Q, unit, precision));

Optional parameters : unit is one of 'm' (meters, default), 'km' (kilometers), 'mile' (miles), 'NM' (nautic miles). Precision is the number of decimals.

This function can also be called this way:

    var geo = require('geolibri');
    var Algiers = geo.point(36.7525000,3.0419700);
    var InGuezzam = geo.point(19.566632, 5.754432)
    console.log("Distance from Algiers(DZ) to In Guezzam(DZ) is : ",geo.distance(Algiers, InGuezzam, "km", 3), " km"); // 1928.06  km
  • bounds( dist ) Returns the coordinates of a square with distance dist east, west, north and south of the current point.
    var geo = require('geolibri');
    var InGuezzam = geo.point(19.566632, 5.754432)
    console.log("Coordinates of points 10km arround In Guezzam(DZ): ", InGuezzam.bounds( 10000 ));

Result:

    {
      minlat: 19.476649629499615,
      maxlat: 19.65661437050038,
      minlng: 5.658988084369061,
      maxlng: 5.849982527975235
    }