@crossbind/port-geos 2.0.0-beta.62 → 2.0.0-beta.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/mergeConfig.mjs +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
**Precompiled GEOS geometry library built with crossbind for seamless integration in JavaScript, WebAssembly and React Native projects.**
|
|
3
3
|
|
|
4
4
|
<a href="https://www.npmjs.com/package/@crossbind/port-geos">
|
|
5
|
-
<img alt="NPM version" src="https://img.shields.io/npm/v/@crossbind/port-geos?style=for-the-badge" />
|
|
5
|
+
<img alt="NPM version" src="https://img.shields.io/npm/v/@crossbind/port-geos/beta?style=for-the-badge" />
|
|
6
6
|
</a>
|
|
7
7
|
<a href="https://github.com/libgeos/geos">
|
|
8
|
-
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%
|
|
8
|
+
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.npmjs.org%2F%40crossbind%2Fport-geos%2Fbeta&query=%24.nativeVersion&style=for-the-badge&label=Geos" />
|
|
9
9
|
</a>
|
|
10
10
|
<a href="https://github.com/libgeos/geos/blob/main/COPYING">
|
|
11
|
-
<img alt="License" src="https://img.shields.io/
|
|
11
|
+
<img alt="License" src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.npmjs.org%2F%40crossbind%2Fport-geos%2Fbeta&query=%24.license&style=for-the-badge&label=license" />
|
|
12
12
|
</a>
|
|
13
13
|
|
|
14
14
|
> Use it together with **[crossbind](https://crossbind.dev)** — the toolchain for using C++ libraries from JavaScript, TypeScript, WebAssembly, Node.js and React Native. Learn more at **[crossbind.dev](https://crossbind.dev)**.
|
|
@@ -26,7 +26,7 @@ Their C++ wrappers, and the self-check the site build runs against values comput
|
|
|
26
26
|
Install the main package together with the platform builds:
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
|
-
npm install @crossbind/port-geos @crossbind/port-geos-wasm @crossbind/port-geos-android @crossbind/port-geos-ios
|
|
29
|
+
npm install @crossbind/port-geos@beta @crossbind/port-geos-wasm@beta @crossbind/port-geos-android@beta @crossbind/port-geos-ios@beta
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Then import all three platforms in `crossbind.config.js` — crossbind compiles only the one matching each build target:
|
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
};
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
A native Node.js addon links the build of its platform:
|
|
51
|
+
A native Node.js addon (`crossbind build -e node`) links the build of its platform: `-p darwin`, `-p linux`, `-p linuxmusl` or `-p win32` takes `@crossbind/port-geos-darwin`, `-linux`, `-linuxmusl` or `-win32`; `-linuxmusl` is the one for Alpine and other musl distributions. Install it and import its `crossbind.config.js` the same way.
|
|
52
52
|
|
|
53
53
|
## Usage
|
|
54
54
|
crossbind binds your C++ headers to JavaScript, so the usual pattern is a small wrapper around the library. This one runs GEOS overlays on shapes written as WKT, through GEOS's reentrant C API. Put it in your project's native folder (`src/native/` by default):
|
|
@@ -161,20 +161,20 @@ console.log(await Overlay.area(await Overlay.unite(parcel, floodZone)), await Ov
|
|
|
161
161
|
- Each call opens its own GEOS context with `GEOS_init_r`, which keeps the reentrant C API safe to call from several threads. When GEOS fails, the wrapper throws GEOS's message; for broken WKT, JavaScript catches an error reading `std::runtime_error: ParseException: Expected word but encountered end of stream`.
|
|
162
162
|
|
|
163
163
|
### More examples
|
|
164
|
-
Each one runs in your browser on [crossbind.dev/ports/geos](https://crossbind.dev/ports/geos/#
|
|
164
|
+
Each one runs in your browser on [crossbind.dev/ports/geos](https://crossbind.dev/ports/geos/#examples), next to the code shown there:
|
|
165
165
|
|
|
166
166
|
- [Test points against a prepared polygon](https://crossbind.dev/ports/geos/#02-zone): `GEOSPrepare_r` once, then `GEOSPreparedContainsXY_r` and `GEOSPreparedIntersectsXY_r` for each point, and `GEOSPreparedRelate_r` for the DE-9IM matrix.
|
|
167
167
|
- [Measure area, length and distance](https://crossbind.dev/ports/geos/#03-measure): `GEOSArea_r`, `GEOSLength_r`, `GEOSDistance_r`, `GEOSNearestPoints_r` and `GEOSGetCentroid_r`.
|
|
168
168
|
- [Buffer points, lines and polygons](https://crossbind.dev/ports/geos/#04-buffer): `GEOSBuffer_r`, `GEOSBufferWithStyle_r` with cap and join styles, and `GEOSOffsetCurve_r`.
|
|
169
169
|
- [Find why a polygon is invalid and repair it](https://crossbind.dev/ports/geos/#05-validity): `GEOSisValidReason_r`, and `GEOSMakeValidWithParams_r` with both of its methods.
|
|
170
170
|
|
|
171
|
-
Setup
|
|
171
|
+
Setup for every platform: [crossbind.dev/ports/geos](https://crossbind.dev/ports/geos/#install). The same page has [a command-line program](https://crossbind.dev/ports/geos/#wasi-program) built with `crossbind build -p wasi -e wasi`.
|
|
172
172
|
|
|
173
173
|
## What this build includes
|
|
174
174
|
- GEOS 3.15.0 (C API 1.21.0) as two static libraries: `libgeos_c`, the stable C API the examples use, and `libgeos`, the C++ library behind it.
|
|
175
175
|
- The C API the apps above run: overlays, prepared predicates and DE-9IM, buffers and offset curves, validity checks and both repair methods, coverage simplification and validation, Delaunay and Voronoi, hulls, and WKT and GeoJSON output.
|
|
176
176
|
- No data files: a GEOS module is its `.wasm` and loader alone. The module behind the five examples and three apps is 1,612,592 bytes of WebAssembly and 138,052 bytes of JavaScript.
|
|
177
|
-
- GEOS's own `geosop` tool is not in the library packages; `@crossbind/port-geos-
|
|
177
|
+
- GEOS's own `geosop` tool is not in the library packages; `@crossbind/port-geos-standalone-wasi` ships it as a WASI command.
|
|
178
178
|
|
|
179
179
|
## Supported platforms
|
|
180
180
|
This is the main package; the precompiled binaries are shipped per platform:
|
|
@@ -186,9 +186,11 @@ This is the main package; the precompiled binaries are shipped per platform:
|
|
|
186
186
|
| iOS | [`@crossbind/port-geos-ios`](https://www.npmjs.com/package/@crossbind/port-geos-ios) | device (`arm64`), simulator (`arm64`) |
|
|
187
187
|
| macOS | [`@crossbind/port-geos-darwin`](https://www.npmjs.com/package/@crossbind/port-geos-darwin) | `arm64` (Apple silicon), `x64` (Intel) — native Node.js addons |
|
|
188
188
|
| Linux | [`@crossbind/port-geos-linux`](https://www.npmjs.com/package/@crossbind/port-geos-linux) | `x64`, `arm64` — glibc 2.28 or later, native Node.js addons |
|
|
189
|
+
| Linux (musl) | [`@crossbind/port-geos-linuxmusl`](https://www.npmjs.com/package/@crossbind/port-geos-linuxmusl) | `x64`, `arm64` — musl 1.2.5 or later (Alpine 3.21 and later), native Node.js addons |
|
|
189
190
|
| Windows | [`@crossbind/port-geos-win32`](https://www.npmjs.com/package/@crossbind/port-geos-win32) | `x64`, `arm64` — Windows 10 or later, native Node.js addons |
|
|
190
191
|
| WASI library | [`@crossbind/port-geos-wasi`](https://www.npmjs.com/package/@crossbind/port-geos-wasi) | `wasm32-wasip3` — single-threaded |
|
|
191
|
-
| WASI command | [`@crossbind/port-geos-
|
|
192
|
+
| WASI command | [`@crossbind/port-geos-standalone-wasi`](https://www.npmjs.com/package/@crossbind/port-geos-standalone-wasi) | the upstream `geosop` CLI as a `geosop-wasi` command (wasmtime 47+) |
|
|
193
|
+
| Node.js, ready-made | [`@crossbind/port-geos-standalone-napi`](https://www.npmjs.com/package/@crossbind/port-geos-standalone-napi) | prebuilt addons for macOS, Linux (glibc and musl) and Windows, `arm64` and `x64`: nothing to build |
|
|
192
194
|
|
|
193
195
|
## License
|
|
194
196
|
This project includes the precompiled GEOS library, which is distributed under the [GNU LGPL 2.1](https://github.com/libgeos/geos/blob/main/COPYING).
|
package/mergeConfig.mjs
CHANGED
|
@@ -6,8 +6,9 @@ export default (newConfig = {}) => ({
|
|
|
6
6
|
},
|
|
7
7
|
export: {
|
|
8
8
|
type: 'cmake',
|
|
9
|
-
bundle: false,
|
|
10
9
|
libName: ['geos', 'geos_c'],
|
|
10
|
+
// The C API is the stable one; GEOS makes no compatibility promise for its C++ headers.
|
|
11
|
+
publicHeaders: ['geos_c.h'],
|
|
11
12
|
// GEOS C++ headers forward-declare the geometry classes their signatures use; bindings need them complete.
|
|
12
13
|
// These are the headers geos/geom.h includes: geos/geom.h itself adds `using namespace geos::geom` globally.
|
|
13
14
|
headerPrelude: [
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossbind/port-geos",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.64",
|
|
4
4
|
"nativeVersion": "3.15.0",
|
|
5
5
|
"description": "This package provides the precompiled GEOS library, built using crossbind, for seamless integration into JavaScript, WebAssembly, and React Native projects. It supports advanced geometry operations, including spatial analysis and topological calculations, delivering high performance and cross-platform compatibility. Perfect for web, server-side, and mobile geospatial applications.",
|
|
6
|
-
"homepage": "https://
|
|
6
|
+
"homepage": "https://crossbind.dev/ports/geos/",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/crossbind/crossbind.git"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
|
-
"license": "LGPL-2.1-
|
|
12
|
+
"license": "LGPL-2.1-only",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"geos",
|
|
15
15
|
"libgeos",
|