@linzjs/geojson
    TypeScript icon, indicating that this package has built-in type declarations

    6.10.0 • Public • Published

    GeoJSON computation

    Utility functions for working with GeoJSON multi polygons and bounding boxes. In particular for handling the anti-meridian.

    Usage

    Wgs84

    import { Wgs84 } from '@linzjs/geojson';
    
    assert(Wgs84.normLon(-163.12345 - 720) == -163.12345;
    
    assert(Wgs84.crossesAM(-175, 175));
    
    assert(Wgs84.delta(-175, 170) == -15);
    
    assert(deepEqual(Wgs84.union([175, -42, -178, -41], [-170, -43, -160, -42]), [175, -43, -160, -41]));

    MultiPolygon

    import { clipMultipolygon,  multiPolygonToWgs84 } from '@linzjs/geojson';
    import * as Proj from 'proj4';
    
    // polygons clipped to bounding box; no degenerate edges
    const clipped = clipMultipolygon(polygons, [-2, -2, 1, 1]);
    
    const nztmToWgs84 = Proj('epsg:2193', 'epsg:4326').forward;
    
    // nztm polygons converted to wgs84 split at anti-meridian
    const splitPolys = multiPolygonToWgs84(nztmPolygons, nztmToWgs84);

    Keywords

    none

    Install

    npm i @linzjs/geojson

    DownloadsWeekly Downloads

    69

    Version

    6.10.0

    License

    MIT

    Unpacked Size

    50.3 kB

    Total Files

    40

    Last publish

    Collaborators

    • linzds
    • blacha
    • philals