cgeo-calc
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

cgeo-calc

npm version

Adds some computational geometry algorithms to cgeo.

This augments all geometry types (in a TypeScript-friendly way) with several methods.

The following treat coordinates as lying on a Cartesian plane, any projections are ignored. Degrees as input coordinates produce nonsensical output.

  • getSimpleArea(), returns a number.
  • getSimpleCentroid(), returns a cgeo.Point.

Usage

import * as cgeo from 'cgeo';
import 'cgeo-calc';
import 'cgeo-wkt';

const line = new cgeo.LineString([{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 2 }]);

console.log(line.getSimpleCentroid().toWKT());

License

The MIT License

Copyright (c) 2017 BusFaster Ltd

Readme

Keywords

none

Package Sidebar

Install

npm i cgeo-calc

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • jjrv