Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cheap-ruler

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheap-ruler

A collection of fast approximations to common geographic measurements.

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is cheap-ruler?

The cheap-ruler npm package provides fast and accurate approximations for common geospatial calculations. It is designed to be efficient and lightweight, making it suitable for applications that require quick distance and area calculations, point projections, and bounding box manipulations.

What are cheap-ruler's main functionalities?

Distance Calculation

Calculates the distance between two points. The example calculates the distance in miles between two coordinates.

const CheapRuler = require('cheap-ruler');
const ruler = new CheapRuler(35.05, 'miles');
const distance = ruler.distance([30.5, 50.5], [30.51, 50.49]);
console.log(distance);

Area Calculation

Calculates the area of a polygon. The example calculates the area in square miles of a polygon defined by a set of coordinates.

const CheapRuler = require('cheap-ruler');
const ruler = new CheapRuler(35.05, 'miles');
const area = ruler.area([[30.5, 50.5], [30.51, 50.49], [30.52, 50.48], [30.5, 50.5]]);
console.log(area);

Point Projection

Projects a point to a new location given a distance and bearing. The example projects a point 10 miles to the east (90 degrees) from the original point.

const CheapRuler = require('cheap-ruler');
const ruler = new CheapRuler(35.05, 'miles');
const point = ruler.destination([30.5, 50.5], 10, 90);
console.log(point);

Bounding Box Calculation

Calculates a bounding box around a point given a buffer distance. The example calculates a bounding box 10 miles around the given point.

const CheapRuler = require('cheap-ruler');
const ruler = new CheapRuler(35.05, 'miles');
const bbox = ruler.bufferBBox([30.5, 50.5], 10);
console.log(bbox);

Other packages similar to cheap-ruler

Keywords

FAQs

Package last updated on 26 Jun 2024

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