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

geos.js

v0.1.5

Published

an easy-to-use JavaScript wrapper over WebAssembly build of GEOS

Downloads

148

Readme

GEOS.js

(WIP) GEOS.js is an easy-to-use geospatial library built on top of GEOS.

The goal of this library is to connect turf-like ease of use with the reliability of GEOS (used by PostGIS, QGIS, GDAL, Shapely and many others).

Try it out

Try out GEOS.js in the interactive playground!

You can also check out API Documentation for live examples!

Project structure

At the core is the C/C++ GEOS library compiled by Emscripten into WebAssembly. Memory management, pointers and other C/C++/Wasm related stuff are handled by JavaScript wrapper, which by exposing a clean API almost makes Wasm an implementation detail for downstream developers.

GEOS.js custom GeoJSON integration offers fast and efficient way to transfer data between JavaScript and Wasm memory. It also has some unique capabilities like:

  • support for feature ID and properties
  • support for Z and M ordinates
  • support for geometries that are not part of the official GeoJSON format: CircularString, CompoundCurve, CurvePolygon etc.

Install

npm i geos.js

Quick start

import { initializeFromBase64, fromWKT, toWKT, toWKB, point, area, buffer, union } from 'geos.js';

// GEOS.js needs to be initialized (to compile Wasm code)
await initializeFromBase64();

// GEOS.js can read and write GeoJSON, WKT and WKB
const p1 = buffer(fromWKT('POINT (1 1)'), 10);
const p2 = buffer(point([ 6, 6 ]), 8, { quadrantSegments: 2 });
const u = union(p1, p2);

console.log(area(u)); // 375.3168319264665
console.log(toWKT(u, { precision: 1 })); // 'POLYGON ((10.8 -1, 10.2 -2.8, 9.3 -4.6, 8.1 -6.1, 6...
console.log(u.toJSON()); // { type: 'Feature', geometry: { type: 'Polygon', coordinates: [ [ 10....
console.log(JSON.stringify(u)); // '{"type":"Feature","geometry":{"type":"Polygon","coordinates"...

console.log(toWKB(fromWKT('POINT Z (1 2 3)'), { flavor: 'iso' })); // Uint8Array(29) [1,233,3,0,...

Bundle size

The main components of the library are a Wasm file and a JavaScript wrapper.

They can be combined into a single .js file where .wasm file data is embedded as Base64 string:

| file | size | gzipped | |----------------|--------:|--------:| | index.min.js | 1400 KB | 469 KB |

or loaded separately:

| file | size | gzipped | |---------------------|--------:|--------:| | geos_js.wasm | 1033 KB | 327 KB | | index-slim.min.js | 24 KB | 7 KB |

index-slim here is a complete JavaScript wrapper, but without initializeFromBase64 function.

License

GEOS.js is licensed under MIT License. GEOS is available under the terms of GNU Lesser General Public License (LGPL) 2.1.

Related Projects

  • The inspiration for this library was the geos-wasm library created by Christoph Pahmeyer
  • Turf - pure JavaScript library with similar functionality
  • Shapely - Python package build on top of GEOS