npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

geometry-kernel

v1.0.0

Published

A Rust-first geometry kernel for deterministic planar geometry operations

Readme

geometry-kernel

geometry-kernel is a Rust-first geometry engine for deterministic planar geometry operations. It is designed for applications where small differences in buffering, overlay, or intersection behavior can materially change downstream results.

The crate is intentionally scoped. It is not a full GIS toolkit and it is not a Rust port of GEOS. The goal is a compact, portable kernel with clear behavior for a focused set of geometry operations.

Status

This is a 1.0.0 package with a focused public API. The API is intended to be stable for core geometry entrypoints, while the implementation can continue improving under the compatibility contract.

Currently supported areas:

  • planar geometry primitives
  • polygon area
  • largest-polygon selection
  • polygon and line buffering
  • polygon intersection and difference
  • line/polygon intersection points
  • canonicalization and precision handling
  • a WebAssembly build for browser use

The pure Rust kernel is the default path. An optional GEOS reference backend is available for tests and compatibility work.

Install

Rust:

cargo add geometry-kernel

JavaScript / WebAssembly:

npm install geometry-kernel

Rust Usage

use geometry_kernel::{
    GeometryKernel, LinearRing, Polygon, PrecisionModel, PureRustKernel,
};

fn main() -> geometry_kernel::Result<()> {
    let polygon = Polygon::new(
        LinearRing::new(vec![
            [0.0, 0.0].into(),
            [10.0, 0.0].into(),
            [10.0, 10.0].into(),
            [0.0, 10.0].into(),
        ]),
        vec![],
    );

    let kernel = PureRustKernel::new(PrecisionModel::floating());
    let area = kernel.polygon_area(&polygon)?;

    assert_eq!(area, 100.0);
    Ok(())
}

JavaScript / WASM Usage

The npm package exposes the WebAssembly build generated from the Rust crate. Initialize the module once, then call the exported JSON APIs.

import init, { polygon_area_json } from "geometry-kernel";

await init();

const polygon = {
  exterior: {
    coords: [
      { x: 0, y: 0 },
      { x: 10, y: 0 },
      { x: 10, y: 10 },
      { x: 0, y: 10 },
      { x: 0, y: 0 },
    ],
  },
  holes: [],
};

const response = JSON.parse(polygon_area_json(JSON.stringify(polygon)));

if (!response.ok) {
  throw new Error(response.error);
}

console.log(response.value);

Feature Flags

| Feature | Purpose | | --- | --- | | pure-rust | Default pure Rust kernel path. | | geos-reference | Optional GEOS reference backend for tests and comparison. Requires GEOS. | | wasm | WebAssembly bindings for core geometry operations. |

Development

cargo test
cargo test --features geos-reference
cargo test --features wasm
cargo check --no-default-features --features wasm --target wasm32-unknown-unknown
npm run build:wasm

Compatibility

geometry-kernel aims for deterministic behavior on the operations it supports. Compatibility is measured by operation tests and reference comparisons, not by claiming to match every behavior of a larger geometry library.

The package keeps a GEOS reference backend available for comparison, but the portable path is pure Rust and WebAssembly-compatible.

Applications with domain-specific output requirements should validate those requirements in their own repositories. This package intentionally does not include application-specific data or acceptance criteria.

Comparison To Other Libraries

| Library | Best fit | How geometry-kernel differs | | --- | --- | --- | | GEOS / JTS | Mature, broad geometry operations with well-known topology behavior. | geometry-kernel is narrower, Rust-first, and designed to run natively or in WebAssembly without shipping GEOS. | | Turf / JSTS | Browser JavaScript GIS utilities and GeoJSON workflows. | geometry-kernel exposes a compact Rust/WASM API for deterministic geometry operations instead of a broad JS toolbox. | | Rust geo | General-purpose Rust geospatial primitives and algorithms. | geometry-kernel is focused on a stricter compatibility contract for buffer, overlay, and deterministic output. | | GEOS-WASM | GEOS semantics in the browser. | geometry-kernel avoids the larger GEOS-WASM payload on the portable path, while keeping a GEOS reference backend for tests. | | Clipper-style kernels | Polygon clipping and offsetting with a compact algorithm family. | geometry-kernel treats semantic compatibility as the promotion gate, not just local polygon similarity. |

For more detail, see docs/geometry-engine-comparison.md.

License

Licensed under either of:

  • Apache License, Version 2.0
  • MIT license

at your option.

Copyright (c) Birk Skyum.