JSPM

geoutils

0.1.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 3
    • Score
      100M100P100Q27025F

    Geographic Formulas for CommonJS

    Package Exports

    • geoutils

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (geoutils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Geographic Utilities for CommonJS

    Largely based (copypasta) on the excellent javascript implementations of various geographic formulas by Chris Veness

    The original scripts have been modified slightly for usage as a CommonJS/Node.js module. Also some functions were wrapped for clarity/consistency.

    Criticism/Suggestions/Patches/Additions/PullReq's welcome.

    Status

    The library works great!

    TODO:

    • Tests for everything (using vows? Might not be good for a non-node module)
    • Add package.json

    Usage

    var gu = require('geoUtils');
    
    var point1 = new gu.LatLon(41.850033, -87.6500523);

    Creates a lat/lon point for Chicago, Il var point2 = new gu.LatLon(43.0730517, -89.4012302); Creates a lat/lon point for Madison, Wi

    point1.distanceTo(point2);

    Great Circle distance. Fairly accurate for most situations. Returns 197.8 kilometers

    point1.distVincenty(point2);

    Vincenty inverse formula distance using a WGS-84 ellipsoid. Very accurate, but slower. Returns 197986.973 meters

    point1.toString('dms', 4);

    Pretty printing and conversion of lat/lon points. Returns 41°51′00.1188″N, 087°39′00.1883″W

    And much more! Please refer to the source for further functions.