Socket
Socket
Sign inDemoInstall

geolib

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geolib

Library to provide basic geospatial operations like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc. This library is currently **2D**, meaning that altitude/elevation is not yet supported by any of its functions!


Version published
Weekly downloads
257K
increased by2.94%
Maintainers
1
Weekly downloads
 
Created

What is geolib?

The geolib npm package provides a set of functions for common geospatial calculations. It allows you to perform operations such as distance calculations, finding the center of a set of coordinates, and working with bounding boxes.

What are geolib's main functionalities?

Distance Calculation

This feature allows you to calculate the distance between two geographic coordinates. The `getDistance` function returns the distance in meters.

const geolib = require('geolib');
const distance = geolib.getDistance(
  { latitude: 51.5103, longitude: 7.49347 },
  { latitude: 51.515, longitude: 7.453619 }
);
console.log(distance); // Outputs distance in meters

Finding the Center of Coordinates

This feature allows you to find the geographic center of a set of coordinates. The `getCenter` function returns the center coordinate.

const geolib = require('geolib');
const center = geolib.getCenter([
  { latitude: 51.5103, longitude: 7.49347 },
  { latitude: 51.515, longitude: 7.453619 },
  { latitude: 51.525, longitude: 7.470 }
]);
console.log(center); // Outputs the center coordinate

Bounding Box Calculation

This feature allows you to calculate the bounding box for a set of coordinates. The `getBounds` function returns the bounding box.

const geolib = require('geolib');
const bounds = geolib.getBounds([
  { latitude: 51.5103, longitude: 7.49347 },
  { latitude: 51.515, longitude: 7.453619 },
  { latitude: 51.525, longitude: 7.470 }
]);
console.log(bounds); // Outputs the bounding box

Other packages similar to geolib

FAQs

Package last updated on 01 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc