Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geoid Height #19

Open
cehanagan opened this issue Jun 16, 2021 · 2 comments
Open

Geoid Height #19

cehanagan opened this issue Jun 16, 2021 · 2 comments

Comments

@cehanagan
Copy link

Hi! I would like to state an initial disclaimer that I am new to C++ and JavaScript, as my background is in geophysics, but I am attempting to create a tool in an Observable Notebook (which runs on JavaScript) that computes the height above the user-specified geoid given a position (lat, lon, height) above the reference ellipsoid (WGS84 system). This utility is available through the command line GeoidEval tool of GeographicLib, but I am having trouble getting it compiled with emscripten. I was wondering if any attempts have been made to produce a webassembly friendly version of this particular geographiclib tool, similar to what you have done with the geodesic tools? Or, alternatively, whether you have a sense of if this is feasible using similar methods that you have already implemented?

@bmershon
Copy link

Follow-up: for now we @unavco are making use of an existing JS port of the Geoid Height calculations written by Kim Vandry:

https://observablehq.com/@bmershon/geoid-height

@schmidtk
Copy link
Contributor

Hello! We have not made any attempts to compile Geoid functions from GeographicLib. It looks like one tricky piece would be getting the Geoid dataset cached, because GeographicLib loads datasets from the file system. Emscripten provides a few options to do this:

  • Packaging Files: Files are packaged into the wasm. This is the easiest option, but not preferred because it unnecessarily bloats the wasm if Geoid is not being used.
  • Synchronous Virtual XHR: This approach lazy loads files from an HTTP server using XHR. It runs in a worker, so it can be done without blocking the main application process. Datasets could be served with the application bundle, and loaded when needed.
  • File System API: Dataset can be loaded at the JS level and made available to the wasm via a few different means (pre-packaged, stored in IndexedDB, or via a File/Blob in a Worker).

Synchronous Virtual XHR seems like a good approach because the work is all done in WebAssembly and datasets are only loaded as needed. For larger sets like egm2008-1, it might be best to use the File System API and make a File accessible in a Worker so the entire set doesn't need to be downloaded and loaded in browser memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants