[PROJ] PROJ on JVM/JS via Native, WebAssembly, and Graal Interop
Will Cohen
wwcohen at gmail.com
Sun Dec 15 18:22:00 PST 2024
Hello all --
Initial builds of this project are now up, implementing up to
`proj_create_crs_to_crs` and `proj_trans_array`, which is enough to
demonstrate loading and processing of objects and creating CRSs and getting
stuff between the hosted languages and the compiled or transpiled version
of PROJ.
Main repository: https://github.com/willcohen/clj-proj
JVM package, on Clojars as `net.willcohen/proj`:
https://clojars.org/net.willcohen/proj
JS package, on NPM as `proj-wasm`: https://www.npmjs.com/package/proj-wasm
Usage on JVM from the Clojure REPL (vanilla Java API still not ready):
net.willcohen.proj.proj> (proj-init)
net.willcohen.proj.proj> (trans-coord (create-crs-to-crs "EPSG:3586"
"EPSG:4326") [0 0 0 0])
;; => [34.24438675300125 -73.6513909034731 0.0 0.0]
Usage on JS, running the following content:
import * as proj from "proj-wasm";
proj.proj_init();
var t = proj.create_crs_to_crs("EPSG:3586", "EPSG:4326");
var c = [0,0,0,0]
console.log(proj.trans_coord(t, c));
yields:
$ node index.mjs
writeStackCookie: 0x00000000
initRuntime
Float64Array(4) [
34.24438675300125,
-73.6513909034731,
4.8569143e-317,
5.7293886364e-313
]
Please feel free to ask any questions you might have here or on the project
repository page.
Will
On Wed, Dec 11, 2024 at 7:43 PM Will Cohen <wwcohen at gmail.com> wrote:
> Hello,
>
> I am very pleased to announce clj-proj (
> https://github.com/willcohen/clj-proj/), a project which provides a
> native (or transpiled) version of PROJ for both the JVM and JS ecosystems.
>
> The goal of this project is to provide a long-missing component of
> geospatial analysis for these platforms: a performant version of PROJ that
> can closely follow upstream development. This should dramatically improve
> the suitability of the JVM and JS ecosystems for advanced open-source
> geospatial uses.
>
> This currently provides bindings to the JVM via Clojure using a package
> that will eventually be published to Maven Central, and to pure Javascript
> via an ES6 wrapper module over a transpiled module that will both
> eventually be published on NPM. By unifying the API for all of this under a
> single Clojure/Clojurescript namespace, it will be easier to maintain
> parity with upstream, expand the reach of platforms to other hosted
> runtimes, as well as make it easier to quickly assess in the longterm where
> in the chain of interop -- actual interaction with PROJ's API, compilation
> issues, webassembly issues, or other javascript or java issue -- the
> wrapper mechanisms are running into difficulty during project maintenance.
>
> Presently, this is very much a work in progress and in some ways only a
> proof of concept. Clojure bindings exist on the JVM, and work on both
> natively compiled PROJ and a transpiled WebAssembly version via GraalWasm.
>
> Much work remains to be done. I've been working on this off and on for a
> few years, and my native javascript work-in-progress module broke at some
> point, so the project is still a bit off from being ready to publish either
> to Maven Central or NPM. That said, I just learned today about the new
> ability to embed the sqlite db into the library itself, which may provide a
> good workaround pending better handling of WASM and additional files across
> node and the web.
>
> I welcome any and all feedback and/or contributions, and am happy to
> answer any questions you may have here or on the project repository. I look
> forward to getting this over the finish line for an initial release, and am
> excited to continue to build it out so it can more fully represent the full
> functionality of what PROJ has to offer, and to provide it to a large
> portion of the computing landscape where the lack of PROJ remains a
> substantial pain point for GIS.
>
> Will
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20241215/bb78289d/attachment.htm>
More information about the PROJ
mailing list