{"id":16386371,"url":"https://github.com/tmcw/geos-wasm","last_synced_at":"2025-03-23T04:31:27.132Z","repository":{"id":66155075,"uuid":"582387575","full_name":"tmcw/geos-wasm","owner":"tmcw","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-26T17:12:39.000Z","size":4,"stargazers_count":17,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-16T01:55:49.349Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmcw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-26T17:04:18.000Z","updated_at":"2023-06-30T14:37:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"9dbc559b-5c70-4b65-abd1-8c4354ed2693","html_url":"https://github.com/tmcw/geos-wasm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fgeos-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fgeos-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fgeos-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fgeos-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmcw","download_url":"https://codeload.github.com/tmcw/geos-wasm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T04:17:05.842Z","updated_at":"2025-03-23T04:31:27.123Z","avatar_url":"https://github.com/tmcw.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"### geos/wasm\n\nGEOS and WebAssembly.\n\nBraindump:\n\nI don't think WebAssembly will constitute a big performance advantage for\ngeographical operations. However, what I do want is battle-tested geometry\noperations. I love Turf, and continue to contribute to Turf, but a lot of Turf's\ngeometry algorithms are implemented from scratch and aren't nearly as robust as\nGEOS.\n\nThen Turf uses JSTS for a few of its operations. JSTS - JavaScript port of JTS,\nwhich is a port of GEOS - has gotten a lot better. Maybe JSTS is the real best\noption: it gives roughly the code of GEOS, albeit removed two steps from the\noriginal, but doesn't have the full serialization cost of a WASM library.\n\nThat said, JSTS is large - we've been trying to remove it from Turf for years\nand years, and it's not _exactly_ the same set of bugs as GEOS. If I have bugs,\nI want all of the GEOS things to have bugs! And the roaring success of, say,\nShapely, indicates that GEOS's level of bugs is pretty tolerable.\n\nSo, the goal of GEOS/WASM is that maybe:\n\n- We can get the same features/bugs as GEOS, with fewer steps to the source than\n  JSTS.\n- We can just use GEOS for a lot of stuff.\n- Maybe it'll be fast, or small? I don't really know, this is all TBD. I've\n  tinkered with WebAssembly but don't know that much about it.\n\n## Other routes\n\n- Maybe rust-geo is robust? But it [doesn't have\n  buffering](https://github.com/georust/geo/issues/641), so probably a no-go.\n\n## Implementation options\n\n- Emscripten: oldest and most established option.\n- Zig: I like Zig, and maybe this would make the toolchain simpler, and I'd much\n  prefer to write Zig than C or C++. But on the\n  other hand, maybe it'd make the process way less documented.\n- Clang: looks like it does WASM directly, too. Looks like Emscripten _uses_\n  LLVM's native support now.\n\n## Notes\n\nOkay, so step one is as painful as expected. Getting the basic GEOS example to compile\nusing any tool is hard. I can't get it compiled with Zig, Emscripten or cc. It's because\nof import paths and stuff. I haven't messed with C in ages.\n\nLooks like there are other people compiling GEOS as a prereq for other stuff.\n\n- https://github.com/bugra9/gdal3.js\n\nOkay, so far seeing:\n\n- I'll need to compile GEOS first, then compile the bindings per the [docs](https://emscripten.org/docs/compiling/Building-Projects.html#using-libraries).\n  Trying to compile GEOS separately isn't working yet.\n\n```\nCXXFLAGS=\"-fexceptions -DRENAME_INTERNAL_LIBTIFF_SYMBOLS -s ERROR_ON_UNDEFINED_SYMBOLS=0\" CFLAGS=\" -fexceptions -DRENAME_INTERNAL_LIBTIFF_SYMBOLS -s ERROR_ON_UNDEFINED_SYMBOLS=0\" emconfigure ./configure --enable-shared=no --disable-inline\n```\n\n- [spl.js](https://github.com/jvail/spl.js) looks _great_. Doesn't compile cleanly\n  for me - missing `libcharset.a`. But still, good to learn from.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fgeos-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmcw%2Fgeos-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fgeos-wasm/lists"}